Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[OT] More features for HTA with MSIE8+

41 views
Skip to first unread message

JJ

unread,
Sep 7, 2019, 3:15:44 AM9/7/19
to
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.

Mayayana

unread,
Sep 7, 2019, 9:31:31 AM9/7/19
to
"JJ" <jj4p...@vfemail.net> wrote

| 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.....
|

Thanks for all that. I've seen that compatible tag
in webpages but didn't know what it meant. It seems
odd outside of HTA. I use quirks mode by just not
adding a DOCTYPE tag. That serves for all browsers.
With IE11 it renders in Edge mode unless otherwise
specified on clientside by adding that domain as an
exemption. (The exemption then changes the userAgent
to IE7.)

In other words, you can spec quirks mode for IE 6-10,
but it won't work in IE11. IE11 breaks compatibility
with IE-specific functionality and the webpage author
gets no say in the matter. So I don't know why anyone
would specify IE11 compatibility in a webpage. It's
interesting that it changes HTA behavior.

As far as I know, IE in an HTA will generally render
as that version. In other words, if you write an HTA with
IE10 you should get IE10 behavior, as long as you add
a suitable doctype tag. I suspect you're seeing the
difference with IE11 because of its unusual Edge pairing.

For my own purposes I always use quirks mode, in HTAs
or webpages. (No doctype tag.) I've never been curious
about SVG drawing
and don't see anything especially relevant in HTML5. And
using quirks mode means I know that anyone, with any IE
version, can load the page and see the same thing with the
same layout. If you don't use quirks mode you need to test
in each IE version. Which is why so many websites use code
like so:
<!--[if lt IE 8]>
<!--[if lt IE 9]>
<!--[if lte IE 10]>

Then they'll specify different CSS specifically for each
IE version. So if your HTA is only used by you then it's fine,
but if you distribute it then you shouldn't make it dependent
on something like canvas.

| 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.

I doubt it. The changes between IE versions are mostly
layout. In one version a table might render 2 pixels higher
than in another version. Stuff like that. I've never encountered
not being able to do what I need to in an HTA. The DOM
is incredibly rich and complex.

I do remember once
writing an HTA in IE5 that had a panel with horiz scrolling
for a number of vertical items. A database view. In IE6 it
went wacky, extending off the page rather than staying in
the panel and scrolling. I had to play with it until I found an
HTML option that worked in both versions. Similarly, older
IE can't treat a DIV as a block object. You have to use a
table. But adding that capability doesn't make a newer
version better. It just makes the two incompatible. If you
want your webpage to always look right then you need to
either use quirks mode or target each IE version separately.

Remember that argument we had about Edge awhile back?
That's the reason I block Edge/IE11. They won't accept
quirks mode. So neither my page for non-IE nor my page for
IE5-10 can be served up. I use PHP to put the page together
during load, depending on whether it's IE or not. Since IE11
default and Edge can't show the IE page properly, not
recognizing quirks mode, I made it 3 options: IE page,
non-IE page, or "woops, sorry" page. The sorry page explains
that IE11 can be adjusted but that Edge just won't work.

Fortunately, The new Edge will have a userAgent "Edg"
and will have a chromium engine. I can just let that UA
go to the non-IE page. And hopefully IE11/Edge will be
phased out as the semi-well-intentioned monstrosities that
they are, leaving Trident to be pretty much used only for
HTAs and help files.


0 new messages