Permission denied when accessing function in parent window

Discussion in 'Javascript' started by johkar, Mar 7, 2006.

  1. johkar

    johkar Guest

    My child window has this script. "temp" is simply the value of the
    select list which I am passing onchange. I get a permission denied
    error in IE when executing selectOption.

    function selectOption(temp){
    if(temp == ''){
    alert('You have not made a selection. Please make a selection
    to continue.');
    return false;
    }
    else
    {
    opener.setValues(temp);
    window.close();
    }
    }

    I launched the window with the following script from the main window:

    function newWindow(myurl,mywidth,myheight,resize) {
    var myDate=new Date();
    var myTime=myDate.getTime();
    var URL=(myurl.indexOf('?') > -1)?myurl + '&time=' + myTime:myurl +
    '?time=' + myTime;
    var w=mywidth;
    var h=myheight;
    var winname='popWindow';
    var winl = (screen.width - w) / 2, wint = (screen.height - h) / 2;
    var
    winresize=(resize=='resize')?'scrollbars=yes,resizable=yes':'scrollbars=no,resizable=no';
    var winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl +
    ',toolbar=no,status=no,menubar=no,' + resize;
    if(win==null || win.closed)//only launch window if it doesn't already
    exist
    win=window.open(URL, winname, winprops);
    win.focus()
    document.onclick=winfocus;//set method to bring window into focus
    }
     
    johkar, Mar 7, 2006
    #1
    1. Advertising

  2. johkar

    Amie Guest

    Last time I had a similiar issue was when the opener and popup scripts
    were on different domain (even subdomain).
    It could be that, or something else.. Just out of curiosity, what does
    setValues function do on the opener script??
     
    Amie, Mar 7, 2006
    #2
    1. Advertising

  3. johkar

    johkar Guest

    It is all the same domain...even the same application...which is why it
    driving me crazy. Set values simply splits the value passed back and
    assigns it to some form fields.
     
    johkar, Mar 7, 2006
    #3
  4. johkar

    johkar Guest

    Found the issue, there was a linked JavaScript file in the main page
    which was setting document.domain='SOMETHING'; If I added that to the
    popup too, all is well.
     
    johkar, Mar 7, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alexander Magidow
    Replies:
    0
    Views:
    129
    Alexander Magidow
    Apr 4, 2004
  2. whidbeywave
    Replies:
    3
    Views:
    214
    whidbeywave
    Jan 16, 2006
  3. Replies:
    19
    Views:
    319
    Kevin Worth
    Sep 8, 2006
  4. FAQ server
    Replies:
    0
    Views:
    107
    FAQ server
    Sep 1, 2006
  5. Replies:
    1
    Views:
    378
    marss
    Nov 1, 2006
Loading...

Share This Page