how to calculate page refresh count in javascript using localstorage only.
I am developing one website. In that website I have to reload the page on any browser simultaneously the count will be increased. if the count equal to 6 enable popup.
how to calculate page refresh count in javascript using localstorage only.
I am developing one website. In that website I have to reload the page on any browser simultaneously the count will be increased. if the count equal to 6 enable popup.
window.addEventListener("unload", function(){
var count = parseInt(localStorage.getItem('counter') || 0);
localStorage.setItem('counter', ++count)
}, false);
if (localStorage.getItem('counter') == 6) {
alert('You refreshed page 6 times')
}
I hope the below link will be help you out.
[blog] http://blogs.sitepointstatic.com/examples/tech/js-session/index.html
[blog] http://blogs.sitepointstatic.com/examples/tech/js-session/session.js