document.location.href not working on Safari 2020

人盡茶涼 提交于 2020-03-19 17:49:30

问题


I'm having issue redirecting a webpage on all browsers. I created a custom page for a client about a year back on SHOPIFY and now the redirect function no longer works.

I was originally using document.location.href = "/cart" and all worked well. But I recieved a call from him today saying the page wont redirect anymore on his IPhone.

I changed it to window.top.location.href, this fixed it for most browsers except safari. I understand that the best way for this to work on all browsers is the document version. But that seems to have been out dated this year.

    setTimeout(function(){ document.location.href = '/cart';},1000);

Checking the user agent of the browser and if it's safari we can do a different tailored version of a redirect, just haven't found out how to do this on the new safari yet.

@stanislav seems to have the same issue from this link, I suspect we will start to see the number of people with this issue growing.

Why isnt window.location.href= not forwarding to page using Safari?

Thanks to all for the input and suggestions, hoping to get the resolved soon.

来源:https://stackoverflow.com/questions/59778280/document-location-href-not-working-on-safari-2020

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