Results 1 to 10 of 10

Thread: document.referer? *resolved*

  1. #1

    Thread Starter
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    document.referer? *resolved*

    A hyperilnk like this:

    Code:
    <a href="#" onClick="javascript:winopen();"><img border="0" src="/images/tellafriend.gif" alt="Tell a Friend"></a>
    Where winopen() is like this:

    Code:
    <script language="javascript">
    function winopen(){
    win = window.open("/tellafriend.php", "newWin", "toolbar=no,location=no,directories=no,status=no, menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=300,height=160")
    }
    </SCRIPT>

    Now, in that tiny little tellafriend.php window, how do I get a hold of the refering page?
    Last edited by mendhak; Jan 28th, 2003 at 06:48 AM.

  2. #2

    Thread Starter
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    document.referer is coming undefined for me.

  3. #3

    Thread Starter
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170


    If I use document.referrer (note the spelling change), it gives me a blank.

    My second question is: what is the correct spelling? referer or referrer?

  4. #4
    Frenzied Member DeadEyes's Avatar
    Join Date
    Jul 2002
    Posts
    1,196
    Code:
    window.opener
    A reference to the window that opened the page.

  5. #5

    Thread Starter
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Originally posted by DeadEyes
    Code:
    window.opener
    A reference to the window that opened the page.
    I'm getting

    [object]

  6. #6
    Frenzied Member DeadEyes's Avatar
    Join Date
    Jul 2002
    Posts
    1,196
    You've got the parent window object

    say the parent has a form called frm
    and a input called txt

    now you can get and set the value of the parent's text
    Code:
    alert(window.opener.document.frm.txt.value)

  7. #7
    Frenzied Member Rick Bull's Avatar
    Join Date
    Apr 2002
    Location
    England
    Posts
    1,444
    He want's the opening window's URI, not a text box's value, so it would be more like this I think:

    Code:
    window.opener.document.URL
    Also I think it's one R in referer, and some versions of IE have trouble offline, but as DeadEyes has said you want window.opener in this case.

  8. #8

    Thread Starter
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    Originally posted by Rick Bull

    Also I think it's one R in referer
    So either the javascript folks (document.referrer) or the PHP folks ($HTTP_REFERER) need to get their english straight.


    Thanks...

  9. #9

  10. #10

    Thread Starter
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    <World-Wide Web> A misspelling of "referrer" which somehow
    made it into the HTTP standard. A given web page's
    referer (sic) is the URL of whatever web page contains the
    link that the user followed to the current page. Most
    browsers pass this information as part of a request.
    Leave it to web designers to screw up the world

Posting Permissions

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



Click Here to Expand Forum to Full Width