Find out whether the page was cached by the browser:
<!DOCTYPE html> <html> <body onpageshow="myFunction(event)"> <p id="demo"></p> <script> function myFunction(event) {/*w w w . ja v a2 s. c om*/ if (event.persisted) { document.getElementById("demo").innerHTML = "The page was cached by the browser"; } else { document.getElementById("demo").innerHTML = "The page was NOT cached by the browser"; } } </script> </body> </html>
The persisted property returns a Boolean value that indicates if the webpage is loaded directly from the server, or if the page is cached, when an onpageshow or onpagehide event occurs.
This property is read-only.