Skip to content Skip to sidebar Skip to footer

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,-2000Set oWMI = GetObject("winmgmts:\\.\root\cimv2")

Function ProcessCount(Exe,File)
  ProcessCount =0Set oProcesses = oWMI.ExecQuery("Select * From Win32_Process")
  ForEach oProcess In oProcesses
    If InStr(oProcess.CommandLine,"\" & Exe) Then
      If InStr(oProcess.CommandLine,"\" & File) Then
        ProcessCount = ProcessCount +1End If
    End If
  Next
EndFunction

If LCase(oHTA.singleInstance)="yes" And ProcessCount("mshta.exe",MyNameHTA)>1Then Window.Close
location.href = MyNameHTM
</script>

IE11-Mode-Test.htm

<!DOCTYPE html><html><head><metahttp-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";
functionPlayVideo(){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><divclass="fc"><p>HTA in IE11 Mode</p></div><br>
File input with Accept attribute:<br><inputtype="file"id="f1"accept="video/*"oninput="PlayVideo()"><br><br><videowidth="100%"controls><sourceid="v1"type="video/mp4"></video></body></html>

Post a Comment for "Equivalent To Accept Attribute In Hta"