javascript - How to capture back button event in Chrome,Firefox and IE -


i have capture if user clicks on button of browser(ie, chrome , firefox)

i don't want onbeforeunload event called when user presses button of browser

update in following function when u click on links see event being fired....now after clicking on link click button youll agin c event being fired.

jsfiddle

$(window).bind( "hashchange", function(e) {    alert()    });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>  <script src="http://github.com/cowboy/jquery-bbq/raw/v1.2.1/jquery.ba-bbq.min.js"></script>    <nav id="sitenav">  <ul>  <li class="nav1"><a href="#landing" title="home">home</a>  <li class="nav2"><a href="#products" title="products">products</a>  <li class="nav3"><a href="#about-us" title="about us">about us</a>  <li class="nav4"><a href="#sign-up" title="sign up">sign up</a>  <li class="nav5"><a href="" title="videos">videos</a>  </ul>  </nav>

use hashchange event:

window.addeventlistener("hashchange", function(e) {   // ... }) 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -