Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / August 2007

Tip: Looking for answers? Try searching our database.

Access denied javascript error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeremy - 30 Jul 2007 17:57 GMT
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;

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.