I'm getting an access denied error from a line of Javascript which I think
comes from some of the ajax plumbing. I debug it in visual studio and the
code is in the ScriptResource.axd file of my application. I've included the
code below, and the access denied error is happening when trying to access
to the top.document.documentElement object. I only get this when my
application is appearing in an IFrame. I also using IE7.
switch(Sys.Browser.agent) {
case Sys.Browser.InternetExplorer:
Sys.UI.DomElement.getLocation = function
Sys$UI$DomElement$getLocation(element) {
/// <param name="element" domElement="true"></param>
/// <returns type="Sys.UI.Point"></returns>
var e = Function._validateParams(arguments, [
{name: "element", domElement: true}
]);
if (e) throw e;
if (element.self || element.nodeType === 9) return
new Sys.UI.Point(0,0);
var clientRects =
element.getClientRects();
if (!clientRects || !clientRects.length) {
return new Sys.UI.Point(0,0);
}
var w = element.ownerDocument.parentWindow;
var offsetL = w.screenLeft -
top.screenLeft - top.document.documentElement.scrollLeft + 2;
bruce barker - 30 Jul 2007 20:53 GMT
script can not access the dom from another site (cross script). if they
are the same site, check if one is a server name and the other an ipaddress.
-- bruce (sqlwork.com)
> I'm getting an access denied error from a line of Javascript which I think
> comes from some of the ajax plumbing. I debug it in visual studio and the
[quoted text clipped - 26 lines]
> var offsetL = w.screenLeft -
> top.screenLeft - top.document.documentElement.scrollLeft + 2;
Jeremy - 30 Aug 2007 00:01 GMT
But why is the script trying to access the dom from another site. The
application in the IFrame should only be accessing it's own dom, and I never
wrote any code to do otherwise.
> script can not access the dom from another site (cross script). if they
> are the same site, check if one is a server name and the other an
[quoted text clipped - 33 lines]
>> w.screenLeft - top.screenLeft - top.document.documentElement.scrollLeft +
>> 2;