处理远程 javascript 错误
我们从 ASPX 页面内部调用 javascript。如下所述:
<script type="text/javascript">
var resultados = false;
function change_source(iframe)
{
iframe.src = 'someURL/index.jsp?querystringparametervalues';
return true;
}
window.onerror = function()
{
if (typeof window.resultados === "undefined")
{
resultados = false;
}
return true;
}
</script>
<iframe width="100%" height="330" frameborder="0"
scrolling="no" onload="change_source(this);" >
</iframe>
错误描述:
IFrame 正在调用一些远程 javascript,其中名为“resultados”的变量未定义。我们试图在本地忽略该错误(本地 javascript)。但我们仍然收到相同的错误“Object”不明确的”。
如何抑制远程 JavaScript 使其不会中断执行?
注意:我们只专注于 IE
更新:
我们尝试过一些愚蠢的操作,例如
禁用
(i) ValidateRequest="false" (ii) Page 指令中的 EnableEventValidation="false"。
服务器端是否有任何解决办法,例如“HttpRequest”/“HttpResponse”/“HttpHandler”/“HttpContext”对象会捕获此类异常并忽略它。
问题是每当我们收到此类错误时,IDE 都会打开“继续/忽略/中断”消息框,这非常烦人。
如果有人指导我解决它,我将非常感激。
先感谢您!
We are calling a javascript from inside our ASPX page.As described below:
<script type="text/javascript">
var resultados = false;
function change_source(iframe)
{
iframe.src = 'someURL/index.jsp?querystringparametervalues';
return true;
}
window.onerror = function()
{
if (typeof window.resultados === "undefined")
{
resultados = false;
}
return true;
}
</script>
<iframe width="100%" height="330" frameborder="0"
scrolling="no" onload="change_source(this);" >
</iframe>
Error Description :
IFrame is calling some remote javascript where in a variable called 'resultados' is undefined.we are trying to ignore the error locally (local javascript).But still we are getting the same error "Object undefined".
How to suppress remote javascript so that it won't break the execution?
Note : We are only concentrating on IE
Update :
We have tried something silly like
disabling
(i) ValidateRequest="false" (ii) EnableEventValidation="false" in Page directive.
Is there any work around from server side like "HttpRequest" / "HttpResponse" /"HttpHandler" / "HttpContext" object will catch these kind of exception and ignore it.
The problem is whenever we receive such error IDE opens up "Continue/Ignore/Break" MessageBox which is quite annoying.
I would be very greatful if someboday guide me to resolve it.
Thank you in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论