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

    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:

    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 10:07 PM.

  2. #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Thanked 257 Times in 253 Posts
    You can access the parent window by using the opener object.
    opener.location.href gives you the url of the opener window.


Posting Permissions

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