Use of [removed] doesn't work on iPad

2019-04-04 08:40发布

I'm using some JavaScript that will redirect the user to another URL after a fixed period of time. This is working well on all browsers but on an iPad 3 I have to test on it isn't working. The timeout fires and I call

window.location = "www.someurl.com"; 

and I've also tried

  window.location.href = "www.someurl.com";

I can see the URL in the browser changing to www.someurl.ocom but the browser doesn't actually go there - it stays on the same page.

Is there something iPad specific I have to do to make this work?

Thanks

2条回答
来,给爷笑一个
2楼-- · 2019-04-04 09:21

try location.href = "...", should work on both

查看更多
神经病院院长
3楼-- · 2019-04-04 09:37

The right answer here is you are missing the protocol. window.location.href = "http://www.someurl.com"; should do the trick

查看更多
登录 后发表回答