Joe*_*ert 4 vbscript hta meta-tags internet-explorer-11
添加到2014年6月19日发布
谢谢邦德.既然你有IE9,我感谢你的测试.希望如果那里的人有IE 10,他们也会测试它.没有任何意义,为什么在IE 11引擎下你只能运行兼容性ie8.
我创建了这个微小的,非常小的HTA,以便发布它,希望我能找到我所缺少的东西.
我的系统是带有IE 11的Win7 Pro 64位.
当我将元标记设置为:
<meta http-equiv="x-ua-compatible" content="ie=8">
Run Code Online (Sandbox Code Playgroud)
HTA运行时非常敏锐.没问题.但当我把它改为:
<meta http-equiv="x-ua-compatible" content="ie=9">
Run Code Online (Sandbox Code Playgroud)
它运行得不那么好.
现在......我知道IE 11和VBScript之间有一个大家庭爆发.VBscript被赶出了家门.IE 11拒绝再与它通信.所以我可以理解为什么将它设置为content ="ie = edge"是行不通的.但是为什么将它设置为content ="ie = 9"时它不起作用?
<!DOCTYPE html>
<head>
<meta http-equiv="x-ua-compatible" content="ie=8">
<hta:application
applicationname="Hmmmmmm"
singleinstance="yes"
id="oHTA"
>
<title>Huh? What?</title>
<script language="VBScript">
Option Explicit
Dim objFSO,file
Sub Window_OnUnLoad
Set objFSO=CreateObject("Scripting.FileSystemObject")
Set file=objFSO.OpenTextFile("c:\temp\submit.txt",2,True)
file.Write oHTA.document.getElementById("aa").value
file.Close
Set objFSO=Nothing
Set file=Nothing
End Sub
Sub Window_OnLoad
window.ResizeTo 240,130
End Sub
Function Form_OnSubmit()
window.Close
Form_OnSubmit=False
End Function
</script>
</head>
<body style="margin:30px;">
<form id="form" action="">
<input id="aa" type="text" size="10" value="test">
<input type="submit" value="Submit">
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
在meta标签中设置为ie8运行它工作正常...窗口弹出,调整大小,并在提交时写入文件... glory-be!
弹出元标记...窗口中设置的ie9运行,忽略调整大小,忽略写入文件...就像忽略所有VBScript一样.
我错过了哪些信息?
看起来IE的后续版本不支持其他答案中提到的HTA.您的问题的一个解决方案是:使您的HTA文件可导航(HTA属性navigable="yes"),并且不指定任何x-ua-compatible元标记.在HTA文件中,导航到另一个具有x-ua-compatible标记的文件.您导航的文件将具有HTA权限:
HTA档案:
<!doctype html>
<html lang="en">
<head>
<HTA:APPLICATION
navigable="yes" />
<script type="text/javascript">
<!--
document.location = 'htacontent.htm';
//-->
</script>
</head>
<body>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
htacontent.htm
<!doctype html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
...
Run Code Online (Sandbox Code Playgroud)