mem64k mem64k - 1 year ago 81
HTML Question

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

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":


<title>Test J</title>


<script language="JScript">

function main()
window.resizeTo(500, 300);

function OnExit()



<body onload="main()">
<input type="button" value="Exit" name="Exit" onClick="OnExit()" title="Exit">

Answer Source

Try adding a try catch around the startup code

    window.resizeTo(500, 300); 
} catch(e) { }

Alternatively try setTimeout:-

setTimeout(function() {
    window.resizeTo(500, 300);
}, 100);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download