?
Solved

browser's back button

Posted on 2012-09-21
6
Medium Priority
?
438 Views
Last Modified: 2012-09-21
I load the whole page, but some divs are hidden from the user, if user selects a product from a list of products, she goes to a detail part of the page (under the hood I just show my div), now would it be possible to program brwoser's back button to hide the detail screen and show the previous one ?
0
Comment
Question by:Rozamunda
  • 4
  • 2
6 Comments
 
LVL 83

Expert Comment

by:leakim971
ID: 38422074
>now would it be possible to program brwoser's back button to hide the detail screen and show the previous one ?

You mean for browser "fully" supporting
$(window).on("beforeunload", function(){ // do the stuff here });

that is? please confirm you know it don't work on all browser and it don't allow you to display a custom message, thanks.
0
 

Author Comment

by:Rozamunda
ID: 38422110
it has to work in IE8, unfortunately
0
 
LVL 83

Expert Comment

by:leakim971
ID: 38422141
Only on IE8 ? It's not a problem...
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Rozamunda
ID: 38423288
thanks it works but how to combine this with a condition, i want this to popup only if for example a div is hidden
0
 
LVL 83

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 38423346
$(window).on("beforeunload", function(){

       if( $("#div_ID").is(":hidden") ) return "ADDITIONAL MESSAGE TO THE NOT REPLACABLE BROWSER MESSAGE";

       // ELSE JUST DO NOTHING, DON'T RETURN ANYTHING
});
0
 
LVL 83

Expert Comment

by:leakim971
ID: 38423348
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn how to dynamically set the form action using jQuery.
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)
Suggested Courses
Course of the Month15 days, 15 hours left to enroll

850 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