SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Grab Parent URL

  1. #1
    SitePoint Member
    Join Date
    Jul 2006
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Grab Parent URL

    Alright so I have a popup, and I need a javascript code that will
    1) Grab the parent URL (The URL of the page that has the link that opens the popup)
    2) Put that URL into a hidden form

    Anyone know how to do this?
    Thanks.

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,875
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    The popup page should contain the following:

    <body onload="document.getElementById('parenturl').value = opener.location.href;">
    <form>
    <input type="hidden" name="parenturl" id="parenturl">
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Member
    Join Date
    Jul 2006
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you. I've been hunting everywher for this!


Bookmarks

Posting Permissions

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