hi
when the browser refresh the page alert("msg") will be show using javascript .
Printable View
hi
when the browser refresh the page alert("msg") will be show using javascript .
Page reload is not directly detectable. Your only option would be to create a cookie with the URL as the value and check for that cookie with the onload event. Then, if the cookie value is equal to the current URL, then the page has either been reloaded, or entered twice.
You should easily be able to figure the code out.
use
<body onload="alert(msg);">
The original poster only wants it when the page is reloaded, not loaded every time.Quote:
Originally Posted by Snowcore
Using PeejAvery's approach, setting the cookie in the onunload event with an expiration of, say 5 seconds would allow detecting the cookie onload. If the cookie is found, throw the alert message.
I recognize the thread is a tad old, but if the original poster wants this type of solution, I suppose he'll be asking how to code it as well. That's where you come in Paul. :)