Welcome to WebmasterWorld Guest from 220.127.116.11
Forum Moderators: open
I thought about using the history.previous method but don't seem to be able to get the url of the page so that I can then identify which image to display.
In English, what I thought I could do was:
Use the onLoad event to capture the history.previous value, then use an if statement to determine which image to display. The images would be in <div> tags both with a 'style=display:none' statement so that they would be hidden.
Can anyone help me with the code that I need to write. Or advise me of a better way to do what I require?
Thanks in advance for any help.
There are several ways to do it. One, you can check the
value .. which should contain the URL for the previous page.
But, you can also use a query string when accessing the page. Instead of linking to
you can link to
is the name of the refering page.
variable will now contain the name of the previous page, and you can check it to hide/unhide images, put in backlinks .. etc
Hope that little info helps :)
Then your script on the target page just extracts the passed variable and writes the appropriate image into the div.
I think this approach would be more dependable than assuming the window history will always give you the object you want. For instance, I often open links in a a new window.