[英]“Access is denied” by executing .hta file with JScript on Windows XP x64
I have a simple HTML (as HTA) application that shows strange behavior on Windows XP x64 machine. 我有一个简单的HTML(作为HTA)应用程序,它在Windows XP x64计算机上显示奇怪的行为。 I getting periodically (not every time) error message "Access is denied."
我收到定期(并非每次)的错误消息“访问被拒绝”。 when I start the application.
当我启动应用程序时。 The same application on Windows XP 32bit runs just fine...
Windows XP 32位上的相同应用程序可以正常运行...
Does somebody has any idea or explanation? 有人有任何想法或解释吗?
Error message: 错误信息:
Line: 18 Char: 6 Error: Access is denied. Code: 0 URL: file:///D:/test_j.hta
Here is the code of my "test_j.hta": 这是我的“ test_j.hta”的代码:
<html>
<head>
<title>Test J</title>
<HTA:APPLICATION
ID="objTestJ"
APPLICATIONNAME="TestJ"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"
>
<script language="JScript">
function main()
{
//window.alert("test");
window.resizeTo(500, 300);
}
function OnExit()
{
window.close();
}
</script>
</head>
<body onload="main()">
<input type="button" value="Exit" name="Exit" onClick="OnExit()" title="Exit">
</body>
</html>
Try adding a try catch around the startup code 尝试添加尝试启动代码
try
{
window.resizeTo(500, 300);
} catch(e) { }
Alternatively try setTimeout:- 或者尝试setTimeout:-
setTimeout(function() {
window.resizeTo(500, 300);
}, 100);
对于通过这里的任何人来说,这只是一个简单的字眼,我遇到了类似的问题(我的是何时已加载文档),这是由于浏览器尚未准备好执行调整大小/移动操作的缘故,无论是否是由于完成加载或(如我的情况)完成加载,或者仍在处理先前的调整大小请求。
With both delay and try-catch: 延迟和尝试捕获:
setTimeout(function() {
try {
window.resizeTo(500, 300);
}
catch(e) { }
}, 100);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.