Problem with window.opener!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • voodoolv
    New Member
    • Aug 2005
    • 2

    Problem with window.opener!

    So..
    I have a javascript that makes a popup with a javscript function in it.
    The function in the popup after 5 seconds tries to change the "price" field value in the opener window:

    Code:
    sourze= "<script type=%20text/javascript%20>
    function change(){ window.opener.document.forms[0].price.value=123;};
    setTimeout('change()',5000);</script>"; 
    thepopup=window.open( '' , 'name' , 'height=5,width=5');
    logs.document.writeln(sourze);
    This bunch of code is working perfectly if it is run from the page where the "price" field is.

    BUT..

    Im trying to launch this script from one page and the "price" field is in another page. So I add to this code one more line

    Code:
    window.location="http://www.anotherpage.com";
    So the script should make a popup with the function and redirect itself. After 5 seconds the popup changes the fields "price" value.
    The whole script looks like this:
    Code:
    sourze= "<script type=%20text/javascript%20>
    function change(){ window.opener.document.forms[0].price.value=123;};
    setTimeout('change()',5000);</script>"; 
    thepopup=window.open( '' , 'name' , 'height=5,width=5');
    logs.document.writeln(sourze);
    window.location="http://www.anotherpage.com";
    Why the hack it is not working?? The popup opens correctly. The main page redirects correctly, but the field changing is not wokring! :mad:
  • voodoolv
    New Member
    • Aug 2005
    • 2

    #2
    Anyone? Maybe it is connected with that the opener somehow changes if the ite is changed?

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      If the site changes, the page is no longer from the same domain. If the popup would be allowed to access the parent window then, it would be a security hole.

      Comment

      Working...