本文共 403 字,大约阅读时间需要 1 分钟。
网上试了很多方法 最终只有一种可以
var newWin = window.open('https://www.baidu.com/');wxPublic().then(res=>{// 重定向到目标页面if(res.data.statusCode!='200'){newWin.location.href ='404页面';return;}newWin.location.href = res.data.responseContent.url;}).catch(()=>{newWin.location.href ='404页面';//失败重定向到404html})
如果 网速慢的话 接口反馈慢 会出现重定向太慢 很长时间停留在 百度页面 所以 最好 先window.open 一个固定好的 loading HTML 失败的话 可以跳转404HTML 也可以 newWin.close 关闭对应的新弹框
转载地址:http://pcptz.baihongyu.com/