如何抑制来自iframe的Internet Explorer 7上的脚本错误?

问题描述 投票:0回答:1

我用C ++构建了一个dll。在其中,我包含cwebpage.dll,它使用Microsoft Internet Explorer 7.0版作为标准,并带有以下用户代理:

Mozila/4.0 (compatible; MSIE 7.0; Windows NT 6.2; WOW64; Tridnet/7.0;
.NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 
3.5.30729)

我显示的网页中的以下行弹出脚本错误。

<iframe id="stream" src="https://player.twitch.tv/?channel=example"></iframe>

该错误以弹出警报形式显示,就像下面的屏幕截图所示。

Script Error

<<

window.onerror = null;

window.onerror=function(){return true;}

不起作用,脚本错误仍然出现。

我发现了如何从Internet Explorer设置中禁用它,这不是我想要的。它必须是我所有dll用户的通用解决方案。我也曾尝试编辑IE调试,将注册表值禁用为“是”,>]

HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\Main Values: Disable Script Debugger/DisableScriptDebuggerIE

但是我没有看到任何效果。脚本错误仍然出现。如何一方面防止出现此错误,另一方面又使脚本继续进行?预先感谢。

我用C ++构建了一个dll。在其中,我包含cwebpage.dll,它使用Microsoft Internet Explorer 7.0版作为标准文件,并带有以下用户代理:Mozila / 4.0(兼容; MSIE 7.0; Windows ...

javascript html c++ iframe webbrowser-control
1个回答
0
投票
例如,Youtube和Facebook不允许其网站显示在iframe中。因此,该错误是由Cloudfront脚本引发的(ddos保护或尝试阻止您的请求)-如何解决-添加

<script type="text/javascript"> window.onerror = function (e) { return true; } </script>

© www.soinside.com 2019 - 2024. All rights reserved.