jquery - How to show an alert after reloading the page in JavaScript? -


i trying make alert box after page reloaded, doesn't work.
please correct code , tell me why?

$("button").click(function(){     window.location.reload();     alert("hello world"); }); 

you can use sessionstorage:

$( "button" ).click( function () {     sessionstorage.reloadafterpageload = true;     window.location.reload(); } ); $( function () {     if ( sessionstorage.reloadafterpageload ) {         alert( "hello world" );         sessionstorage.reloadafterpageload = false;     } } ) 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -