1. 程式人生 > >微信BUG之微信內置的瀏覽器中window.location.href 不跳轉

微信BUG之微信內置的瀏覽器中window.location.href 不跳轉

href details clas pan 模擬 dom sdn times word

最近做微信開發遇到這個問題,查了一些文檔,總結一下

1.url後面加參數

indow.location.href = url +‘?timestamp=‘+ new Date().getTime()+Math.random();

2.模擬觸發a標簽

<a id="alink" href="abc.aspx" style="visibility: hidden;">下一步</a>
$("#alink").click(); // 觸發了a標簽的點擊事件,但是沒有觸發頁面跳轉
document.getElementById("alink").click(); //既觸發了a標簽的點擊事件,又觸發了頁面跳轉

註意:把 “下一步” 改為 “<span id="spanId">下一步</span>” 即給A標簽中的文字添加一個能被jQuery捕獲的元素,然後$("#spanId").click();,才可以觸發頁面跳轉。

轉載博文地址(上述非原創):

https://blog.csdn.net/tel13259437538/article/details/80850637

https://blog.csdn.net/m0_37950366/article/details/70207429

微信BUG之微信內置的瀏覽器中window.location.href 不跳轉