Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Child and Parent windows

    I have a HTML file in a window (Window1) containing a textbox and a button.
    The button opens a sized window (Window2) which the user can use to browse to whichever page they want anywhere on the internet.
    When they close Window2 I want the last url they visited (i.e. the current url of Window2) to populate the text box on my original page (Window1) .
    Can this be done?

    Could you give me any pointers?

    I would really appreciate any help you could give me.

    Mary Hill
    Senior Analyst
    Sheffield Hallam University
    ENGLAND

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Nope.
    That cannot be done due to the same-origin security policy. You are only allowed to read the URL of files that reside in your domain, everything else is considered an infringe on privacy.

  • #3
    Regular Coder
    Join Date
    Jul 2002
    Location
    Western US
    Posts
    169
    Thanks
    0
    Thanked 0 Times in 0 Posts
    mordred is correct there, but.... if you were tracking on an intranet you could get the location of the child window by polling it.

    Try this, it was a proof of concept. Note that it will only show URLS that are on the same server. It updates every second, and has a counter in it, the thought was to time how long the user was at a particular page. It never got off the ground as we convinced them it was not a good idea to spy so blatantly

    Code:
    <form name=temp method="post" action="http://www.xmission.com/~tnelson/mirror.php" onSubmit="return validateForm(this)">
    <a href="javascript:showSecondWindow()">New Window</a><br>
    <input type="text" name="URL" size="50" value=""><br>
    </form>
    
    <script language="JavaScript">
    function showSecondWindow(){
    	Swin=window.open("","SecondWindow","");
    	Swin.document.clear();
    	Swin.document.close();
    	setTimeout("checkPage()",1000)
    
    }
    myCount = 0;
    function checkPage(){
    	myCount++;
    	document.temp.URL.value = myCount + "URL: " + Swin.location;
    	setTimeout("checkPage()",1000)
    }
    </script>
    ShriekForth


  •  

    Posting Permissions

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