JJ
2019-09-07 07:15:37 UTC
In the past weeks, I wanted to programmatically create and draw images from
scratch using HTA. I thought about using the HTML5's Canvas element because
I already have MSIE11 in my Windows 7 system, but turns out that it doesn't
recognize the <canvas> HTML tag.
I've been wondering why MSHTA can't recognize the <canvas> HTML tag, while
IEXPLORE (the MSIE web browser) can. Turns out that MSHTA defaults to IE7
mode, rather than the currently installed MSIE version (IE11 in my case).
Since then, after some searching, I finally found it. The solution is to use
the "X-UA-Compatible" HTTP header via <meta> HTML tag to tell MSHTA to use
IE11 mode (and Standard mode too). e.g.
<meta http-equiv="x-ua-compatible" content="IE=edge" />
FYI, the "Edge" here, is IE11. But for Windows 7, it's not identical to Edge
of the EdgeHTML web browser engine, because in Windows 7, part of some
features are missing. e.g. touch, device orientation, high DPI support,
phone number format recognition, etc. They're not very important, IMO.
The super duper good news is that, ActiveX is still supported by MSHTA under
Edge mode. FYI, Edge mode in IEXPLORE has no support for ActiveX at all. So
IMO, the Edge mode in MSHTA is superior than the one in MSIE11.
Because the "X-UA-Compatible" HTTP header is supported since MSIE8, and
Windows XP can use MSIE up to version 8, MSHTA in Windows XP should also be
able to use IE8 mode instead of IE7 or IE6 using below <meta> HTML tag.
<meta http-equiv="x-ua-compatible" content="IE=8" />
Although there's no HTML5 in IE8, IE8 has a view more HTML, CSS, and
JavaScript feature implementations than in IE7 and IE6. It should provide a
little more capabilities for HTAs.
scratch using HTA. I thought about using the HTML5's Canvas element because
I already have MSIE11 in my Windows 7 system, but turns out that it doesn't
recognize the <canvas> HTML tag.
I've been wondering why MSHTA can't recognize the <canvas> HTML tag, while
IEXPLORE (the MSIE web browser) can. Turns out that MSHTA defaults to IE7
mode, rather than the currently installed MSIE version (IE11 in my case).
Since then, after some searching, I finally found it. The solution is to use
the "X-UA-Compatible" HTTP header via <meta> HTML tag to tell MSHTA to use
IE11 mode (and Standard mode too). e.g.
<meta http-equiv="x-ua-compatible" content="IE=edge" />
FYI, the "Edge" here, is IE11. But for Windows 7, it's not identical to Edge
of the EdgeHTML web browser engine, because in Windows 7, part of some
features are missing. e.g. touch, device orientation, high DPI support,
phone number format recognition, etc. They're not very important, IMO.
The super duper good news is that, ActiveX is still supported by MSHTA under
Edge mode. FYI, Edge mode in IEXPLORE has no support for ActiveX at all. So
IMO, the Edge mode in MSHTA is superior than the one in MSIE11.
Because the "X-UA-Compatible" HTTP header is supported since MSIE8, and
Windows XP can use MSIE up to version 8, MSHTA in Windows XP should also be
able to use IE8 mode instead of IE7 or IE6 using below <meta> HTML tag.
<meta http-equiv="x-ua-compatible" content="IE=8" />
Although there's no HTML5 in IE8, IE8 has a view more HTML, CSS, and
JavaScript feature implementations than in IE7 and IE6. It should provide a
little more capabilities for HTAs.