Ok, I misunderstood what it did. It seems to work ok on both IE and Firefox always returning a value when navigating from a page but being null when accessing the page directly because there is no referer.

So Ive just coded my page like to only show a back link when actually come from another page.

<% if (request.getHeader("REFERER")!=null) { %>
   <p><a href="<%=request.getHeader("REFERER")%>">back</a></p>
<% } %>
<p></p>

Jon Wingfield wrote:

Also from Section 14.36 of rfc2616:

<extract>
The Referer field MUST NOT be sent if the Request-URI was obtained from source that does not have its own URI, such as input from the user keyboard.
</extract>


So you can't rely on it being present.


Shapira, Yoav wrote:

Hi,


But I have 2 questions:
1. Where are these header values defined I've not beeen able to find a
good source.



See the HTTP protocol RFC itself for common headers like referrer. Other servers and routers may add custom headers along the way. Your app and other apps can also use custom headers if they wish.


2.  It worked when coming from my pages but I then tried going to
another page (e.g www.sun.com) and then pasting in the url and it just
returned null. Does referer only apply when hyperlink from another


page ?

Some browsers, including IE, are known to have bugs regarding the
referrer header.  Sometimes it's null or not included in the request at
all.  So your app, if it uses the referrer header, must be tolerant of
these bugs.

What about a history.go(-1) alternative to the referrer header?

Yoav



This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you.


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]





--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to