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 03-16-2005, 09:01 PM   PM User | #1
snospunjah
New to the CF scene

 
Join Date: Mar 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
snospunjah is an unknown quantity at this point
send current URL through window.open

hello all,

my situation:

on my main page i have a link, using window.open to popup a small page in which i have several forms for emailing the "current page" to a friend. The only problem is that the script i am using on that popup uses window.location for determining the current page. Obviously the "current page" seen by window.location is going to be the URL for the popup, not the parent page, which i wanted. can i set a variable on the main page to that URL (using window.location), and then pass it to the new window to be used by my scripts there? how? any other ideas?

here is the generic script for emailing the "current" page to a friend, which is in my popup window generated from window.open:

Code:
function initMail(form) {
text = "Check out this page:  " + window.location;
form.message.value = "Hi " + form.sendto.value + " (" + form.to.value + "):\n\n"
 + text + "\n\nYour Friend,\n" + form.sendername.value + "(" + form.senderemail.value + ")";
return (form.to.value != "");
}
hopefully this was clear enough.

thank you!

Last edited by snospunjah; 03-16-2005 at 09:07 PM..
snospunjah is offline   Reply With Quote
Old 03-17-2005, 03:04 AM   PM User | #2
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
You can access the parent window by using the opener object.
opener.location.href gives you the url of the opener window.
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app
glenngv 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 02:41 PM.


Advertisement
Log in to turn off these ads.