【question】
When developing WeChat pages, the jump between each home page is entirely done through the a link, but it jumps back and forth several times. When jumping back to the home page from other home pages again, a jump loading progress bar appeared on the head of WeChat, but it just didn't jump and there was no reaction.
【scope】
Only appear on the built-in browser of WeChat
【Solution】
Just put any parameter after the originally jumped link, that is:
The code copy is as follows:
<a href="http://www.baidu.com">Baidu</a>
become
The code copy is as follows:
<a href="http://www.baidu.com?love">Baidu</a>
【Note】The parameter love can be arbitrary, according to personal preference
PS: The problem of link a failure in WeChat
Example 1:
The code copy is as follows:
<a href="tel:400-4000-0000" >XXX</a>
The href in this a tag calls the mobile phone number. When clicking on this a tag, a prompt pops up whether to dial the number. There is no problem using it in a mobile browser, but in WeChat, on Android phones, the tag will be invalid when it is 5.0.1 or above. (It is not clear whether the latest WeChat version solves this problem). In this case, it will:
The code copy is as follows:
<a href="tel:400-4000-0000" >XXX</a>Change to
<a link="tel:400-4000-0000" >
This can solve some Android models (but not all), and some models still cannot. This has something to do with the WeChat client. No satisfactory solution was found at present.
When a connection jumps to the home page problem
Prevent a from jumping
$(document).on("click","a",function (event){ event.preventDefault(); if ($(event.target).attr("href")){ location.href = $(event.target).attr("href"); } else { location.href = $(event.target).parent().attr("href"); }});Hide WeChat toolbar
document.addEventListener('WeixinJSBridgeReady', function onBridgeReady(){ WeixinJSBridge.call('hideToolbar');});