<html>
<body>
<p>Use the addEventListener() method to attach a "pageshow" event to the window object.</p>
<h1 id="demo"></h1>
<script>
window.addEventListener("pageshow", myFunction);
function myFunction() {
document.getElementById("demo").innerHTML = "Welcome To My Homepage!";
}
</script>
</body>
</html>