修复h5记事本不显示问题

This commit is contained in:
2026-08-18 09:25:51 +08:00
parent aed71d237d
commit 0e797c39f4
11 changed files with 911 additions and 452 deletions
+10 -3
View File
@@ -174,8 +174,9 @@ var loadScript = function (url, cb, timeout) {
script.charset = "UTF-8";
script.async = true;
// 对geetestçš„é™æ€èµ„æºæ·»åŠ crossOrigin
if ( /static\.geetest\.com/g.test(url)) {
// 对geetest的静态资源添加 crossOrigin。
// file:// 本地页(App web-view)带 crossOrigin 会触发 CORS,必须跳过。
if ( /static\.geetest\.com/g.test(url) && window.location.protocol !== 'file:') {
script.crossOrigin = "anonymous";
}
@@ -381,7 +382,13 @@ window.initGeetest4 = function (userConfig,callback) {
if (userConfig.https) {
config.protocol = 'https://';
} else if (!userConfig.protocol) {
config.protocol = window.location.protocol + '//';
var locProtocol = window.location.protocol;
// file:// / app:// 不能沿用当前协议,否则会请求 file://static.geetest.com
if (locProtocol === 'http:' || locProtocol === 'https:') {
config.protocol = locProtocol + '//';
} else {
config.protocol = 'https://';
}
}