The recent project needs a multi-image upload function, but the problem is that there is no problem in Android, but on iOS is always invalid signature, but refreshing the page is no problem.
Vue Main, router use history mode, plus JSSDK package
The situation is always found to find out the reason, and the magic is on the Android can normally get the location, just on iOS has been "invalid signature", print out the current URL with the signed URL is also clearly consistent, why still signed there is a problem!!???
The structure of the page is as follows:
SPA:
Very simple, the entire application from a into, and then jump to b,b need to get the location, I also just in B inside the configuration of JSSDK, and then encountered the problem mentioned above. And then!! The key is coming!! At a certain time, I just refresh from the B page, and then I can!!!!! What the fu*k?!!
Every time the reload from B is so silky, and from A to B, every shot, so with this problem, I came to this new world----about html5-history mode in the browser problem
Originally, is Jiangzi?!!
Ios:ios version, Android version, each time you switch routes, the URL of the spa will not change, the URL parameter that initiates the signature request must be the URL of the current page, or the URL when the page was originally entered
Android: Android version, each time you switch routes, the URL of the spa will change, and the URL parameter that initiates the signature request must be the URL of the current page (not when the page was originally entered)
Hang Daddy! I'm just comparing the URL of the request signature to the URL of the current page (LOCATION.HREF).
Solution Solutions
Decide whether iOS or Android then do the operation in Beforerouteenter.
Beforerouteenter (to, from, next) {
var u = navigator.useragent;
var Isios =!! U.match (/\ (i[^;] +;( U;)? Cpu.+mac OS x/); iOS terminal
XXX: Fix iOS version HTML5 history compatibility issue
if (Isios && to.path!== location.pathname) {
Location.replace is not available here
Location.assign (To.fullpath)
} else {
Next ()
}
}
This will be solved, this problem has not been the whole week, the answer format of the Internet, now sorted out, hoping to help the same as my small partners.
Vue solves the problem of invalid signature on iOS by using JS SDK on mobile side