Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

detect browser's back button

Posted on 2003-03-27
5
Medium Priority
?
843 Views
Last Modified: 2007-12-19
hi,
I'm using php for web developement, & i have a requirement like this:
how do i detect if the user had clicked the browser's back button.
If he clicks the browser's back button, i need to do some processing.
how can i detect it?In case it can be detected using javascript, wud it work in all the browser's.
plz help me
tnx
bobbie
0
Comment
Question by:tn_bobbie
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 

Author Comment

by:tn_bobbie
ID: 8222443
plz help me,
i need this badly
bobbie
0
 
LVL 46

Accepted Solution

by:
fritz_the_blank earned 300 total points
ID: 8222518
It is a really hard thing to do!!!

In ASP, you can get around the issue by setting a session variable to true when the page is first posted. When the page is loaded, your server side code checks to see if the variable is true. If it is, then the back button has been pressed, otherwise, it is the first visit to the page.

You can also put this on the page:

<body onLoad="history.forward()">

if there is no forward history, nothing will happen. On the other hand, if someone hits the back button, it will put them right back to where they were.

Fritz the Blank
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 8222524
BTW, I notice that you give a lot of B's and leave many questions untended. That will not endear you to the folks who volunteer time free of charge to help you out.

You might want to consider giving better grades to show your appreciation and to close out your old questions in a timely manner.

Fritz the Blank
0
 
LVL 30

Expert Comment

by:third
ID: 8222676
if you want to stop the browser from adding your pages in history then make your application open in a new window and change each of your link to,

<a href="next.html" onclick="window.location.replace(this.href);return false;">next page</a>
0
 

Author Comment

by:tn_bobbie
ID: 8223451
thanks guy for the info,
probably i need to look for a change in the design,
thanks any way,
i will lock the posts here after.
bye
bobbie
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to implement server side field validation and display customized error messages to the client.
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question