Microsoft HTA/Changing Internet Explorer Version

From Computernewb Wiki
Jump to navigation Jump to search
< Microsoft HTA/CSS and JavaScript!Microsoft HTA/Buttons and forms >


By default, HTAs display webpages in Compatibility View, this means that content is displayed in Internet Explorer 7. It's just Internet Explorer 6 but with few more features. To change IE version, you need to use <meta http-equiv="x-ua-compatible" content="ie=yourversion"> in <head> of page. The lastest IE version is 11, but note that IE 10 has dropped support for <hta:application> settings, so if you want settings, use ie9, that support some HTML5 (for example SVG) and CSS3 (for example box-shadow) features. If you don't need settings, set ie=edge, that will render the page in the latest available Internet Explorer version on the system.

This example is SVG enabled:

Language: HTA, File Name: svg.hta
<html>
<head>
  <title>SVG-Enabled HTML Application</title>
  <meta http-equiv="x-ua-compatible" content="ie=9">
  <hta:application 
     applicationname="Test app"
     version="1"
  </hta>
</head>

<body>

<p>Because this HTA includes an X-UA-Compatible header, 
it is displayed in IE9 Standards mode when Internet 
Explorer 9 is installed on the system.  As a result,
SVG can be used to draw a blue star.</p>     

<svg width="12cm" height="4cm" viewBox="0 0 1200 400"
     xmlns="http://www.w3.org/2000/svg" version="1.1">
  <desc>Example Star</desc>
  <polygon 
      fill="blue" stroke="blue" stroke-width="10" 
      points="350,75  379,161 469,161 397,215 423,301 
              350,250 277,301 303,215 231,161 321,161" />
</svg>
</body>
</html>
</code>