Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get the url of previous page on click of browser back button

 
soni lal
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I need to get the url from which the browser back button has been clicked

Suppose I am in page http://jchou.apple.com/kb/index?page=search&q=ipod&src=support_site.kbase.search.advanced having some href which is taking me to new page e.g http://jchou.apple.com/kb/HT1201

Now in page :http://jchou.apple.com/kb/HT1201 I clicked browser back button and came to previous page.

Here I have to get the information that from which page browser back button has been clicked.
I tried to use document.referrer but I didn't get the url of the page (where browser back button is clicked).

Please help me.

Thanks in advance.
 
Robin John
Ranch Hand
Posts: 281
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume that the webpages you have mentioned in questions are your applications pages ? and if not I assume they are just examples, and if examples then you have your own webpages in which you are trying to control the "back" button of the browser. If yes then look at the below link, it has a nice example on controling the browser back button. I tried it in IE and it works like a charm. But you have to test it for other browsers
WARNING - its messy.. and its not a good design to control any browser related functionality, avoid if you can

Link using javascript.-> webpage

you can modify the above code to show your browser's url like ->
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic