0

I have some web application at say www.somewebsite.com, when user refreshes the page, I want it to navigate to say www.google.com or anything else.

What I tried was attach event

window.onunload = function(){...}

and

window.beforeunload = function(){...}

I tried

window.location = "http://google.com"

for some reason it is not working.

Anybody has idea how to solve this problem?

Thanks in advance.

4

1 回答 1

0

它不能完成。浏览器不允许在 onunload 或 onbeforeunload 中更改窗口 url。所以,任何试图做同样事情的人都不要浪费你的时间。

于 2012-05-26T20:46:40.547 回答