SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Threaded View

  1. #1
    SitePoint Member
    Join Date
    Jun 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Permission Denied Error

    I get JavaScript Permission Denied error while trying to call a JS function from the OPENER page. I am aware of the “SAME ORIGIN POLICY” of JavaScript which prevents document or script loaded from one origin from getting or setting properties of a document from a different origin.

    I will explain the scenario.

    I have a Main page with several Iframes in it. One of the frames has a page (let’s call it Opener)which has a button on it, onclick of which a pop up window opens. The script to open the page comes from the database entry.

    javascriptarent.openWindow("../loading.aspx?forwardUrl=./Report/Adhoc/Theme/popup.aspx!floor={0}","adhoctheme", "status=no,toolbar=no,directories=no,scrollbars=no,menubar=no,resizable=no,width=950,height=700")

    // Open window is JS function defined in the Main page.

    In the popup page I have a link which calls the JS function of the Main page. While clicking this link to call the JS function I get the permission denied error.
    The onclick event of link fires the following Jscript function.

    function refreshFloorPlan()
    {
    var floorIdEle = document.getElementById("_floorId");
    if (floorIdEle != null)
    {
    opener.parent.parent.refreshFloorPlan(floorIdEle.value);
    }
    }


    There is absolutely no problem in getting the opener page and though getting the opener.parent.parent page.
    The problem starts when I reload the opener.parent page through the JS function which is in opener.parent.parent page.
    For the first time it works perfectly fine. But from second time onwards, ( the page is reloaded in the first instance), it doesn't permit me to access it.

    Here is the JS function ( present in the opener.parent.parent)

    // function refreshFloorPlan()
    function displayRFP(locCode, flr)
    {
    _breadCrumbCallback.Callback("floor#" + locCode+"#"+flr);
    var frameUrl = "./loading.aspx?forwardUrl=./Viewer/Viewer.aspx!"; frameUrl = frameUrl + "floorId=" + flr +"|view=floormap" ;
    var param = "floor#"+flr+"$ dummy"; _detailMenuCallback.Callback(param);
    MapFrame.document.location = frameUrl; var urlParam = "facility=" + "|bldg=|floor="+flr+"|space=|report=floor|mode=";
    var basePageUrl="./loading.aspx?forwardUrl=";
    updateLocationSummary(urlParam, basePageUrl);
    }

    If I do some other operation like getting an element from opener.parent.parent page, everything works fine.
    I guess whenever the page is reloaded, it assumes that the domain has been changed, whereas the domain is still "localhost" for all the pages.


    Please note the domain of all the page is localhost.

    Could anyone please give me some clue to resolve this issue.

    Thanks in advance

    -S
    Last edited by satyajitg; Jul 2, 2007 at 05:17. Reason: More explanation


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •