Creating A Real
BACK Button
|
|||||||||||||||||||||||||||||
|
How did you do that?
The Apache Environment variable, HTTP_REFERER is used above to show you the full URL of the page that brought you here. In the example above, Extended SSI (XSSI) logic was used to see if there was a value in the HTTP_REFERER variable. This allows you to handle situations such as bookmarks or browsers that do not report a value for the HTTP_REFERER. Let's look at the source code:
<!--#if expr="${HTTP_REFERER} =/http/" -->
<B>You came from <!--#echo var="HTTP_REFERER"--></B>
<!--#else -->
<B>I don't know where you came from</B>
<!--#endif -->
The if statement basically says, "If the HTTP_REFERRER contains an
expected value, such as http which is in all URL's, create a link,
otherwise print a message indicating a problem."
I don't have XSSI, Can I still have a back button?
<A HREF="<!--#echo var="HTTP_REFERER"-->">BACK</A>
How do I keep people on my site?
<!--#if expr="${HTTP_REFERER} =/bignosebird/" -->
Return to <A HREF="<!--#echo var="HTTP_REFERER"-->">previous
page</A>
<!--#else -->
Return to <A HREF="http://www.bignosebird.com/">front page</A>
<!--#endif -->
What this code is doing is checking to see if the value "bignosebird" is
contained in the HTTP_REFERER. If so, give the reader a link that takes
them back to the referring page, otherwise (assuming they came from off-site)
take them to our home page!
If you are curious, at BNB we just use the back button to take you to the page the tutorial is listed on. This way I bring my reader to the place containing the most related information to what they might be looking for.
|
![]() |
|
|
|
|
| <reallybig.com>
Web Builder Network Portal |
| Advertise on the Reallybig.com Network |
| BigNoseBird Newsletter |
|
|