Use of window.location doesn't work on iPad

柔情痞子 提交于 2019-12-21 07:34:34

问题


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


回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/16714578/use-of-window-location-doesnt-work-on-ipad

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!