Page cached tracking using javascript

91 views Asked by At

How to check whether the page is cached in browser using javascript in all browser? I want to execute one javascript function only on when back button is pressed in a browser.

1

There are 1 answers

0
Musakkhir Sayyed On BEST ANSWER

we can achieve this using JQuery History plugin.

$(document).ready(function()
{
$('body').append('<div class="is_cached"></div>');
});

History.Adapter.bind(window,'statechange',function(){
if($('.is_cached').length >= 1)
{
  alert('this page is cached');
}
});