/    Sign up×
Community /Pin to ProfileBookmark

Permission Denied Error

I get JavaScript Permission Denied error while trying to call a JS function from the [B]OPENER [/B]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 [B]Main [/B]page with several Iframes in it. One of the frames has a page (let’s call it [B]Opener[/B])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.

javascript:parent.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 [B]popup [/B]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 [B]onclick [/B]event of link fires the following Jscript function.

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

Please note the domain of all the page is [B]localhost[/B].

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

Thanks in advance

  • S
  • to post a comment
    JavaScript

    2 Comments(s)

    Copy linkTweet thisAlerts:
    @LeeUJun 28.2007 — I believe it's because it's on a local host.
    Copy linkTweet thisAlerts:
    @satyajitgauthorJun 28.2007 — Thanks for reply. I don't think localhost is an issue. I have some 40 pages with similar code.

    Also, there is absolutely no problem in getting the opener page and though getting the opener.parent.parent page for some other operation.

    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()

    [FONT="Courier New"]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);

    }[/FONT]

    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.
    ×

    Success!

    Help @satyajitg spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.20,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...