Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-01-2002, 03:48 PM   PM User | #1
maryhill
New to the CF scene

 
Join Date: Aug 2002
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
maryhill is an unknown quantity at this point
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
maryhill is offline   Reply With Quote
Old 08-01-2002, 04:43 PM   PM User | #2
mordred
Senior Coder


 
Join Date: Jun 2002
Location: frankfurt, german banana republic
Posts: 1,848
Thanks: 0
Thanked 0 Times in 0 Posts
mordred is an unknown quantity at this point
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.
mordred is offline   Reply With Quote
Old 08-01-2002, 04:50 PM   PM User | #3
ShriekForth
Regular Coder

 
Join Date: Jul 2002
Location: Western US
Posts: 169
Thanks: 0
Thanked 0 Times in 0 Posts
ShriekForth is an unknown quantity at this point
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
ShriekForth is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:14 AM.


Advertisement
Log in to turn off these ads.