Question:
In the share friends (circle of friends), you can share on Android, report on IOS: invalid signature.
According to:
IOS: Every time the route is switched, the URL of SPA remains the same. [Is the URL when entering the page initially]
Android: The SPA URL will change every time the route is switched. [Not originally entered the page]
Answer:
Because, the URL parameter that initiates the signing request must be the URL of the current page.
Therefore, the address is stored in the hook for route initialization or route switchover, and the Url to be used for initiating a signature is determined based on the device type during sharing.
// Before switching routes
const routerOnChange = () = > {
if(!window.wxSignatureUrl) window.wxSigntureUrl = window.location.href;
}
// Before invoking the signature interface
if(!!!!! navigator.userAgent.match(/\(i[^;] +; ( U;) ? CPU.+Mac OS X/){
signatureUrl = window.wxSignatureUrl
}
signatureUrl = window.location.href;
Copy the code