SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Nov 2005
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    document.referrer does not work in popup window

    Hi,

    How do I find out the referral page (URL of the page that sent you to the current page) using javascript, when you're in a popup window?

    My situation is like this:
    Once the popup is opened, it loads a page eg. page_1.htm

    page_1.htm leads to page_2.htm.

    In page_2.htm I need to get the URL of the page that lead the user to page_2.htm. So the referall URL in this case should be page_1.htm

    How do I do this? I tried but it dosent work. Any idea why it wont work and how I can get it to work?

    Thanx

  2. #2
    SitePoint Enthusiast
    Join Date
    Nov 2005
    Location
    London, UK
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That has nothing to do with popups does it?

    How about something like this...

    page_1.htm:
    <a href="page_2.htm" onclick="location.href=this.href+'?referrer='+encodeURIComponent(document.referrer); return false">

    Then in page_2.htm you can parse the location object to find out where they came from when they go to page_1.htm.


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
  •