Hi, IE (5.x) is known to have this issue with the Referer header. If you are relying on the referrer header (which is not a good idea in general, but sometimes necessary), you will simply have to "add it" to your JavaScript. In your case, change document.location="SecondServlet" to document.location="SecondServlet&myReferer=blahblah". SecondServlet would then look for that myReferer param if the Referer header is not found, and try to deal with it. Remember to urlEncode the blahblah URL ;)
Most designs I've seen that rely on the Referer header can instead be done with a marker parameter in the request, e.g. comingFrom. So you would have document.location="SecondServlet&comingFrom=firstServlet". Then SecondServlet (and in fact all your servlets, or you could refactor this behavior into a Filter) would look from comingFrom instead of the Referer header. Yoav Shapira Millennium ChemInformatics >-----Original Message----- >From: Maria Tan [mailto:[EMAIL PROTECTED]] >Sent: Monday, July 29, 2002 6:34 PM >To: [EMAIL PROTECTED] >Subject: getHeader("Referer") and document location > >Hi, All: > >I have two servlets. > >In my first servlet,I use the >document.location="SecondServlet" in my Java script >for URL Rewriting, > >In my second servlet, i use getHeader("Referer") to >get the referer. It works well in Netscape, but in >IE(5.5),it always returns null. > >String ref = (String)request.getHeader("Referer"); >(ref returns null in IE, return URL in Netscape). > >Any suggestion? If IE didn't pass the Referer through >Java script, is there another way to work around? > >Thanks > >Maria > > >__________________________________________________ >Do You Yahoo!? >Yahoo! Health - Feel better, live better >http://health.yahoo.com > >-- >To unsubscribe, e-mail: <mailto:tomcat-user- >[EMAIL PROTECTED]> >For additional commands, e-mail: <mailto:tomcat-user- >[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
