0

Im looking for a simple cross-browser plugin or method that can help me do this :

$('#clear_window').click(function(){
    $('#window').fadeOut(50);
        var activeTab = $("ul.tabs li.active").find("a").attr("href");
        $(activeTab).fadeIn(50);
});

but on the click of the browsers back button not on the #clear_window click

re1man
  • 2,337
  • 11
  • 38
  • 54

2 Answers2

1

You can through HTML5 History API. But this only supported by Gecko (Firefox), Chrome and Internet Explorer 10+

For what you want you can read it in MDN documentation.

However, if you can how your application handle your URLs, then you can implement it through the hashchange event, similar to how this jQuery plugin handles it.

Arturo Sevilla
  • 227
  • 1
  • 8
0

You cannot detect broswer's back button click. The only way to do is to detect "leave page" event. This might help... Best way to detect when a user leaves a web page?

Community
  • 1
  • 1
Moe Sweet
  • 3,683
  • 2
  • 34
  • 46