homepage Welcome to WebmasterWorld Guest from 54.161.179.218
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
once upon a time in a browser
refferer puzzle
pelachrum

10+ Year Member



 
Msg#: 4863 posted 7:05 am on Jan 14, 2006 (gmt 0)

why does this work in Firefox but not in IE?

<script language="JavaScript" type="text/javascript">
<!--

if (document.referrer == "http://mysite.com/group.html")
document.write('You came from group');

//-->
</script>

 

Bernard Marx

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4863 posted 2:52 pm on Jan 14, 2006 (gmt 0)

Some things don't work quite right in browsers when working within file system (ie file: protocol). It took me a while to find this out for the onerror event for images in Moz.

If you have a local webserver, try getting the document.referrer property, and it will magically appear.

pelachrum

10+ Year Member



 
Msg#: 4863 posted 5:43 pm on Jan 14, 2006 (gmt 0)

...and by that you mean?

Bernard Marx

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 4863 posted 8:00 pm on Jan 14, 2006 (gmt 0)

Put the script inside a page being served from a webserver and it will work in IE too.

pelachrum

10+ Year Member



 
Msg#: 4863 posted 2:56 am on Jan 15, 2006 (gmt 0)

thanks

I've decided to go with php, at least one thing that actually works in this world lol

whoisgregg

WebmasterWorld Senior Member whoisgregg us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4863 posted 9:43 pm on Jan 16, 2006 (gmt 0)

Don't forget that the referrer string can not be trusted. A user can alter what, if any, data they send as the referrer.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved