Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
596 views
in Technique[技术] by (71.8m points)

internet explorer - How to get IE9 standards support for dialogs opened by HTA?

I'm translating some of my old HTAs from Quirks to IE9 standards. However, it seems that modal and modeless dialogs opened by HTA don't support IE9 standards mode.

Test dialog:

<!DOCTYPE html>
<html>
<head>
<title>TestDialog</title>
<meta http-equiv="x-ua-compatible" content="ie=9" />
</head>
<body>
<svg>
    <circle cx="100" cy="100" r="50" fill="#0f0" />
</svg>
</body>
</html>

In the HTA main page:

<button onclick="showModalDialog(...)">Modal</button>
<button onclick="showModelessDialog(...)">Modeless</button>

When opening TestDialog from HTA, it's empty. If the main page is a regular html-document, the green circle appears in the dialog. When opening from HTA, there's no difference if the dialog file itself were htm or hta.

I've also tested addEventListener() but it also won't work in dialogs.

So, can I "force" dialogs to support IE9 standards when opening from HTA?


EDIT

It seems that modal and modeless dialogs opened from HTA are on the level of IE8. This same happens when using IE10 in Windows7.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

A quick Google of the keywords in this question gave me this page on Microsoft MSDN site: http://msdn.microsoft.com/en-us/subscriptions/ms536496(v=vs.85).aspx

The answer to your question is on tha page. The answer is to add an x-ua-compatible meta tag to your HTML's <head> section.

To quote:

By default, HTAs display webpages in Compatibility View, which displays standards-mode content in IE7 Standards mode and quirks mode content in IE5 (Quirks) mode. To utilize features available to current versions of Internet Explorer, use the meta element to define an X-UA-Compatible header for your HTA

The tag would look like this:

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

The above is according to the MSDN site. In fact, I'd suggest that using content="ie=edge" would be better than specifying IE9 mode. Otherwise you'll lose out on any new features in IE10 when you upgrade to that.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...