Note that there are some explanatory texts on larger screens.

plurals
  1. POcode to detect browser back button click for any(all) browser
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/54539/prevent-use-of-the-back-button-in-ie">Prevent Use of the Back Button (in IE)</a><br> <a href="https://stackoverflow.com/questions/87422/disabling-back-button-on-the-browser">Disabling Back button on the browser</a><br> <a href="https://stackoverflow.com/questions/780718/how-to-disable-back-button-in-ie-and-firefox">How to disable Back button in IE and firefox?</a> </p> </blockquote> <p>Penalty of times, i did not think it appropriate to post this question because it has been already asked lot of times, but this time I am posting being ready for consequences, because I have no other option. I will answer any comments, I can also show my try(in which you would be interested) at any link given below.</p> <p>I have a loginpage and a page1. I need to handle or not work browser back button on loginpage. It is possible as <strong>I have done it for FF and Chrome</strong> but unable to do for IE. My working code for FF is following.</p> <pre><code>window.onload = function () { if (typeof history.pushState === "function") { history.pushState("jibberish", null, null); window.onpopstate = function () { history.pushState('newjibberish', null, null); // alert('back button pressed'); // This works in Chrome and FireFox but not in IE }; } } </code></pre> <p>I need to have some code (working on all browsers) in my loginpage so that : <strong>Desired Output :</strong> pressing back button on login page would not take user back to page1 (<strong>just like facebook login page</strong>). <strong>I do not want to disable back button</strong>, just to handle its click on loginpage.</p> <p><strong>Edit</strong> From Comments. <strong>Please give answer what to do</strong>, i have read "Not to do this" but not what to do. Following Code works on pageload ever time except when this page (page1) is loaded through a back button click on loginpage</p> <pre><code> if (Session["role"] == null) Response.Redirect("login.aspx"); </code></pre> <p>I have tried to follow a few questions on same issue, but have been unable to get what I need. I will prefer not using window.location.hash just but ready if there is no other solution</p> <p><a href="http://www.codeproject.com/Tips/135121/Browser-back-button-issue-after-logout" rel="nofollow noreferrer">Code Project - Browser back button issue after logout</a></p> <p><a href="http://www.csharpcourses.com/2008/05/detect-back-button-of-browser.html" rel="nofollow noreferrer">BlogSpot - Detect back Button of Browser</a></p> <p><a href="https://stackoverflow.com/questions/961188/disable-browsers-back-button">SO - Disable browser back Button</a></p> <p><a href="https://stackoverflow.com/questions/87422/disabling-back-button-on-the-browser">SO - Disabling Back button on the browser</a></p> <p><a href="https://stackoverflow.com/questions/6359327/detect-back-button-click-in-browser">SO - Detect Back Button Click</a></p> <p><a href="https://stackoverflow.com/questions/680785/on-window-location-hash-change">SO - On window.location.hash - change?</a></p> <p>Following are few plugins. I tried to follow, but don't know if they are made for what I need and if they are I have been unable to use any of them correctly</p> <p><a href="http://www.codeproject.com/Articles/19562/Salajax-simple-Ajax-library-solving-back-button-an" rel="nofollow noreferrer">Salajax: simple Ajax library</a></p> <p><a href="http://www.ajaxonomy.com/2007/web-design/a-better-ajax-back-button-solution" rel="nofollow noreferrer">A better AJAX Back Button Solution</a></p> <p><a href="https://github.com/browserstate/history.js" rel="nofollow noreferrer">history.js</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload