如何获得对 HTA 打开的对话框的 IE9 标准支持? [英] How to get IE9 standards support for dialogs opened by HTA?

查看:18
本文介绍了如何获得对 HTA 打开的对话框的 IE9 标准支持?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将我的一些旧 HTA 从 Quirks 翻译成 IE9 标准.但是,HTA 打开的模态和非模态对话框似乎不支持 IE9 标准模式.

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.

测试对话框:

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

在 HTA 主页:

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

从 HTA 打开 TestDialog 时,它是空的.如果主页是常规 html 文档,则对话框中会出现绿色圆圈.从 HTA 打开时,对话框文件本身是 htm 或 hta 没有区别.

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.

我也测试了 addEventListener() 但它也不能在对话框中工作.

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

那么,从 HTA 打开时,我可以强制"对话框支持 IE9 标准吗?

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

编辑

从HTA打开的模态和非模态对话框好像是在IE8的水平上.在 Windows7 中使用 IE10 时也会发生这种情况.

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

推荐答案

在这个问题中的关键字的快速谷歌给了我 Microsoft MSDN 站点上的这个页面:http://msdn.microsoft.com/en-us/subscriptions/ms536496(v=vs.85).aspx

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

您的问题的答案在那个页面上.答案是在 HTML 的 部分添加 x-ua-compatible 元标记.

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.

引用:

默认情况下,HTA 在兼容性视图中显示网页,在 IE7 标准模式下显示标准模式内容,在 IE5 (Quirks) 模式下显示怪癖模式内容.要利用当前版本的 Internet Explorer 可用的功能,请使用 meta 元素为您的 HTA 定义 X-UA-Compatible 标头

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

标签看起来像这样:

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

以上是根据MSDN站点.事实上,我建议使用 content="ie=edge" 会比指定 IE9 模式更好.否则,当您升级到 IE10 时,您将失去 IE10 中的任何新功能.

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.

这篇关于如何获得对 HTA 打开的对话框的 IE9 标准支持?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆