HTA and 'x-ua-compatible' meta tag

Joe Weinpert picture Joe Weinpert · Jun 19, 2014 · Viewed 9.8k times · Source

Added to post Jun-19-2014

Thanks Bond. Since you had IE9, I appreciate your test. Hopefully if somebody out there has IE 10 they will test it, too. It does not make any sense why under the IE 11 engine you can only run compatibility up to ie8.


I created this tiny, itty-bitty HTA in order to post it so hopefully I can find out what I am missing.

My system is a Win7 Pro 64bit with IE 11.

When I set the meta tag as:

<meta http-equiv="x-ua-compatible" content="ie=8">

the HTA runs peachy-keen. No problems. But when I change it to:

<meta http-equiv="x-ua-compatible" content="ie=9">

it doesn't run so good.

Now ... I know that there was a big family blow-out between IE 11 and VBScript. VBscript got booted out of the house for good. IE 11 refuses to communicate with it anymore. So I can understand why setting it to content="ie=edge" would not work. But why doesn't it work when setting it to content="ie=9"?

<!DOCTYPE html>
<head>
<meta http-equiv="x-ua-compatible" content="ie=8">
<hta:application
applicationname="Hmmmmmm"
singleinstance="yes"
id="oHTA"
>
<title>Huh? What?</title>
<script language="VBScript">

Option Explicit
Dim objFSO,file

Sub Window_OnUnLoad
   Set objFSO=CreateObject("Scripting.FileSystemObject")
   Set file=objFSO.OpenTextFile("c:\temp\submit.txt",2,True)
   file.Write oHTA.document.getElementById("aa").value
   file.Close
   Set objFSO=Nothing
   Set file=Nothing
End Sub

Sub Window_OnLoad
   window.ResizeTo 240,130
End Sub

Function Form_OnSubmit()
   window.Close
   Form_OnSubmit=False
End Function

</script>
</head>
<body style="margin:30px;">
<form id="form" action="">
<input id="aa" type="text" size="10" value="test">
<input type="submit" value="Submit">
</form>
</body>
</html>

Running it as ie8 set in the meta tag works fine ... window pops up, gets resized, and writes to the file on submit ... glory-be!

Running it as ie9 set in the meta tag ... window pops up, resizing is ignored, and writing to the file is ignored ... as if all the VBScript is being ignored.

What information am I missing?

Answer

regulus picture regulus · Feb 10, 2016

Looks like later versions of IE is not supporting HTA as mentioned in the other answers. One solution to your problem is: Make your HTA file navigable (HTA attribute navigable="yes") and do not specify any x-ua-compatible meta tags. In the HTA file navigate to another file which has the x-ua-compatible tag. The file you navigated will have the HTA priviliges:

HTA File:

<!doctype html>
 <html lang="en">
  <head>
   <HTA:APPLICATION 
    navigable="yes" />
  <script type="text/javascript">
  <!--
    document.location = 'htacontent.htm';
  //-->
  </script>
 </head>
 <body>
 </body>
</html>

htacontent.htm

<!doctype html>
<html lang="en">
  <head>
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
...