DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Advanced JavaScript question - IE

  1. #1
    Kaushik Raj Guest

    Advanced JavaScript question - IE


    consider this situation

    Window A opens a new Window B.

    B can access window A's href by window.opener.location.href

    However if you change the page ( go to some other page in window A),
    then calling window.opener.location.href from window B will have "permission
    denied error".

    Is there anyway we can check that the window A's location has changed ?

    thanks in advance,
    kaushik


  2. #2
    luke Guest

    Re: Advanced JavaScript question - IE


    "Kaushik Raj" <kraj@inventa.com> wrote:
    >
    >consider this situation
    >
    >Window A opens a new Window B.
    >
    >B can access window A's href by window.opener.location.href
    >
    >However if you change the page ( go to some other page in window A),
    >then calling window.opener.location.href from window B will have "permission
    >denied error".
    >
    >Is there anyway we can check that the window A's location has changed ?
    >
    >thanks in advance,


    Howzabout this in the top of the new page?

    < HTML>
    < HEAD>
    < TITLE>TEST</ TITLE>

    < SCRIPT>
    <!--
    var thelink = new Object;
    thelink.thelocation = window.opener.location.href;

    function changeWindow(url) {
    var loc = window.opener.location.href;
    if(loc == thelink.thelocation) {
    window.opener.location.href = url;
    }
    else {
    alert("location has changed from:"+thelink.location+":to be:"+loc+":");
    }
    }
    //-->
    < /SCRIPT>
    < /HEAD>
    < BODY>

    < A HREF="JavaScript: changeWindow('http://www.lycos.com')"> change < /A>

    < /BODY>
    < /HTML>

    (you might wanna take out the alert!)

    >kaushik
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center