Equivalent To Accept Attribute In HTA
Is there an equivalent of the accept attribute (in ) which works in HTA (or in IE7 because HTA works like IE7)?
Solution 1:
You can have both the features provided by an <hta:application>
tag and use IE10 and IE11 features, such as the accept
attribute in <input type="file">
, by splitting your HTA into two parts as shown in the example below.
Note: The SingleInstance
attribute has to be replicated with code.
IE11-Mode-Test.hta
<meta http-equiv="X-UA-Compatible" content="IE=9">
<HTA:Application
ID=oHTA
Navigable=yes
Application=yes
Icon="C:\Program Files\Internet Explorer\iexplore.exe"
Caption=yes
Sysmenu=yes
Scroll=no
SingleInstance=yes
>
<script language="vbscript">
MyName = "IE11-Mode-Test"
MyNameHTA = MyName & ".hta"
MyNameHTM = MyName & ".htm"
Window.ResizeTo 100,100
Window.MoveTo -2000,-2000
Set oWMI = GetObject("winmgmts:\\.\root\cimv2")
Function ProcessCount(Exe,File)
ProcessCount = 0
Set oProcesses = oWMI.ExecQuery("Select * From Win32_Process")
For Each oProcess In oProcesses
If InStr(oProcess.CommandLine,"\" & Exe) Then
If InStr(oProcess.CommandLine,"\" & File) Then
ProcessCount = ProcessCount + 1
End If
End If
Next
End Function
If LCase(oHTA.singleInstance)="yes" And ProcessCount("mshta.exe",MyNameHTA)>1 Then Window.Close
location.href = MyNameHTM
</script>
IE11-Mode-Test.htm
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=11">
<script>
x = 800; y = 620;
window.resizeTo(x,y);
window.moveTo ((screen.availWidth - x)/2, (screen.availHeight - y)/2)
document.title = "IE11-Mode-Test";
function PlayVideo(){v1.src = f1.value;}
</script>
<style>
.fc {display:flex; justify-content:center; align-items:center; height:50px; border:3px solid}
#f1 {width:100%}
</style>
</head>
<body>
<div class="fc">
<p>HTA in IE11 Mode</p>
</div><br>
File input with Accept attribute:<br>
<input type="file" id="f1" accept="video/*" oninput="PlayVideo()"><br><br>
<video width="100%" controls>
<source id="v1" type="video/mp4">
</video>
</body>
</html>
Post a Comment for "Equivalent To Accept Attribute In HTA"