Reputation: 516
There is a situation that when a user came back to a page by clicking back button then I need to send an ajax request. Is there any solution?
Thanks
Upvotes: 1
Views: 236
Reputation: 537
The following article should answer your question:
Detecting when a page is loaded from the browser cache.
The concept of the above article is that at every request you set the cookie from the server side and check the cookie using JavaScript (or jQuery). if the cookie matches that of the previously requested page, then it is a cached page. If it doesn't, it is a fresh page.
Hope that helps.
Upvotes: 0