JavaScript“拒绝访问”错误 - 没有iframe [英] JavaScript "Access is Denied" error - no iframes

查看:559
本文介绍了JavaScript“拒绝访问”错误 - 没有iframe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在IE8中的客户应用程序中看到间歇性的JavaScript拒绝访问错误。某些用户偶尔会发生错误,而其他用户从不会发生错误。

We are seeing an intermittent JavaScript "Access is Denied" error in a customer application in IE8. The error occurs occasionally for some users and never for other users.

我可以通过跳过几个圈来可靠地重现我的浏览器错误:

I am able to reliably reproduce the error on my browser by jumping through a few hoops:


  • 转到相关页面(注意Internet区域,即使Web服务器是在我们的子网上运行的测试服务器)

  • 打开Internet Security Properties(显示的消息) 某些设置由系统管理员管理)

  • 打开本地Intranet

  • 点击网站

  • 请点击确定

  • 单击确定

  • 注意区域已更改为本地Intranet(即使我没有进行更改)

  • 单击页面上的下拉列表

  • JavaScript错误类型为null或不是对象

  • Go to the page in question (note the Internet zone, even though the web server is a test server running on our subnet)
  • Open Internet Security Properties (message displayed that "some settings are managed by your system administrator")
  • Open Local Intranet
  • Click Sites
  • Click OK
  • Click OK
  • Note the zone has changed to Local intranet (even though I didn’t make an changes)
  • Click a dropdown on the page
  • JavaScript error "type is null or not an object"

调试到该错误显示它在Sys.UI.DomEvent函数中的Microsoft.Ajax.js中抛出,并且向上调用堆栈显示根错误发生在Sys.UI.DomEvent中.addHandler当它调用Sys.UI.DomElement._getWindow(a).event( a的类型为DispHTMLWindow2),它抛出异常:

Debugging into that error shows it being thrown in Microsoft.Ajax.js in the "Sys.UI.DomEvent" function, and walking up the call stack shows that the root error occurs in "Sys.UI.DomEvent.addHandler" when it calls "Sys.UI.DomElement._getWindow(a).event" (a is of type DispHTMLWindow2) which throws an exception:

name: TypeError
description: "Access is denied."
message: "Access is denied."
number: -2147024891

其他用户在不进入Internet安全属性的情况下看到错误。

我在访问被拒绝错误上所做的所有研究都指向使用来自不同来源的iframe的问题,所以我从相关页面中删除了所有iframe,但我仍然看到错误。

All the research I’ve done on "Access is denied" errors points to a problem using iframes from different sources, so I removed all the iframes from the page in question, but I still see the error.

什么可能导致JavaScript访问被拒绝没有任何iframe的页面中的错误?

推荐答案

原来这是因为某些原因造成的当用户在广泛使用JavaScript的特定页面上时,Internet安全区偶尔会切换。当IE中的页面在加载后更改安全区域时,它无法执行访问页面上控件的父窗口的JavaScript。

Turns out that this occurs because something is causing the Internet Security Zone to switch occasionally while users are on a particular page that uses JavaScript extensively. When a page in IE changes security zone after it has been loaded, it is unable to execute JavaScript that accesses the parent window of the controls on the page.

仍不确定是什么导致页面更改安全区域,但这似乎只发生在我们通过IP引用站点时,而不是主机名(总是显示为本地Intranet区域)。

Still not sure what is causing the page to change security zones, but this appears to only happen when we reference the site by IP, not host name (which always shows up as Local Intranet zone).

这篇关于JavaScript“拒绝访问”错误 - 没有iframe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆