How do you suppress script errors in HTAs?
I have an HTA that loads up an external webpage inside a nested IFRAME. This webpage (which I don't have control over) throws an "Access Denied" error in my HTA asking the user if they "want to continue running scripts on this page". What I want to do is have m开发者_运维技巧y HTA suppress all scripting error messages regardless of where they originate
Here's a very basic idea of how my setup is working:
<html>
<head><HTA:APPLICATION ... ... </head>
<body>
...
<div id="navigation">...</div>
<div id="browsers">
<iframe APPLICATION="yes" src="http://myserver/browse.php?src=http://www.example.com/">
<!-- contents of http://myserver/browse.php?src=http://www.example.com/ -->
<html>...
<body>
<div id="titlebar">...</div>
<iframe APPLICATION="no" src="http://www.example.com/">
<!-- contents of http://www.example.com/ with js that causes error -->
</iframe>
</body>
</html>
</iframe>
<iframe APPICATION="yes" src="http://myserver/browse.php?src=somethingelese"></iframe>
</div>
</body>
</html>
And here is a screenshot of the error:
As far as I know there isn't a way to suppress errors like that. If you have access to their registry or group policy here is the relevant Registry Value (for IE naturally) that disables that popup:
Key: HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main
Name: Disable Script Debugger
Type: REG_SZ
Value: no
A sentinent GetWindowText() -> SendMessage WM_CLOSE based dialog closer could deal with that but is not exactly disabling
I've been searching for days and haven't found solid solution - perhaps HTAs do not serve their simplistic rationale after all, at least when using actual browser info
By the way changing the IE8 script debugger does not disable the error message - it merely disables the debug dialog and replaces it with a script error
Unchecking the IE flag "Error Dlg Displayed On Every Error" does not alleviate the issue either
精彩评论