Access denied javascript error

  • Thread starter Thread starter Jeremy
  • Start date Start date
J

Jeremy

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;
 
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)
 
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.

bruce barker said:
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 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;
 
Hi, I know this post has a long time.
But I thing I find the answer.
I had the same problem.
And when you look your script code, is correct but...
that is the difficult, thing about xsl code.
When you have the xsl:include balise in your xsl code.
Internet Explorer say "refuse".
good bey.
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;
On Monday, July 30, 2007 3:53 PM bruce barker wrote:
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)

Jeremy wrote:
 
Back
Top