Click here to Skip to main content
15,884,996 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i hv used this Code but not working.

JavaScript
$(document).on("pageload", function () {
       alert("pageload event fired!");
       window.history.forward();
   });
Posted
Updated 11-Jun-15 20:36pm
v2
Comments
Member 11536400 12-Jun-15 1:27am    
Not working
Arkadeep De 13-Jun-15 2:13am    
I tried this a few days back, I was failed to disable the back button of a browser. And as experts say it is impossible. So I found another way to get that and this is use of window.onbeforeunload. try this one, I hope your problem will be over. this one will fire whenever user will want to get out of the site, either by back button or browser or tab close.
John C Rayan 15-Jun-15 11:29am    
Be warned that window.onbeforeunload event will not work in all browsers.
Arkadeep De 15-Jun-15 14:10pm    
I tried in most of the common browsers like chrome. fire fox and ie..it was working...
John C Rayan 16-Jun-15 4:29am    
Are you sure that it works across all IE versions and Safari, Opel.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900