jquery - change URL of current page on reloading using javascript -


my requirement change url of current page on clicking refresh icon or ctrl+r. on refresh, reload page(different url). , should support browsers. have tried below snippet. not working.

window.onbeforeunload = function(e) {   window.location.href = 'www.google.com'; }; 

where 'google.com' should url of page on refreshing current page. it's nothappening window.onbeforeunload().

onbeforeunload needs return value work, actually, display message asking user if he's sure wants leave page (just facebook when try leave page pending changes).

as far know, web browsers don't want give control on that, due websites redirecting users when try leave , stuff that, there's nothing "standard way" , if find workaround, i'm pretty sure not work on browsers. why customer wants behaviour on website? @ least in opinion, thing horrible user experience end users.


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -