background
July 2017 (Chrome 60) SharedArrayBuffer introduced.
Chrome 92 limits SharedArrayBuffer to be used only in Cross-Origin Isolated pages.
Android Chrome 88 has the same restriction.
1. SharedArrayBuffer degrades ArrayBuffer
if(! crossOriginIsolated) { SharedArrayBuffer = ArrayBuffer; }Copy the code
Pros: Simple and rough
Disadvantages: May affect functions
2. Respond to COOP and COEP headers
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp
Copy the code
Advantages: Supports most browsers such as Chrome and Firefox, which is the current long-term solution.
Disadvantages: Affecting window/IFrame callback applications (third-party login, payment, etc.), affecting script tags loading cross-domain resources.
3. Add Chrome Origin Trials
This method is only supported in Chrome, and is supported up to Chrome 104 in July 2022
# registration page for Token https://developer.chrome.com/origintrials/#/registration # Token placed page meta tags or response headers Origin - trials < meta http-equiv="origin-trial" content="REGISTER GET TOKEN"> Origin-Trial: REGISTER GET TOKENCopy the code
Pros: Simple and rough
Cons: Chrome only