js调起iOSApp使用window.location.href

2023-06-23  本文已影响0人  生命不止运动不息

在html中通过js调起App,但使用window.location.href跳转无效

通过universal link方式,访问通用链接,调起App

原方法无效:
window.location.href = ''

解决方案,将window去掉

location.href = ''

例如:
let url = 'https://vbukom.xinstall.com.cn/tolink'
location.href = url

在iframe内部,使用href跳转失败问题

解决方案:top属性直接获取顶层的父窗口

//如果窗口没有父窗口,则top是对自身的引用(窗口=== window.top)
window.top.location.href = ''
上一篇 下一篇

猜你喜欢

热点阅读