修复: 恢复WebView跨域设置(本设备必需) + 工作版index.html

This commit is contained in:
LukeMackin
2026-07-21 20:19:23 +08:00
parent 7f22d4028f
commit f4ee38f39f
6 changed files with 6 additions and 3 deletions

View File

@@ -14,12 +14,15 @@ class MainActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
val wv = WebView(this).apply {
if (BuildConfig.DEBUG) {
if (0 != (applicationInfo.flags and android.content.pm.ApplicationInfo.FLAG_DEBUGGABLE)) {
WebView.setWebContentsDebuggingEnabled(true)
}
settings.javaScriptEnabled = true
settings.domStorageEnabled = true
settings.allowFileAccess = true
settings.allowFileAccessFromFileURLs = true
settings.allowUniversalAccessFromFileURLs = true
settings.mixedContentMode = android.webkit.WebSettings.MIXED_CONTENT_ALWAYS_ALLOW
addJavascriptInterface(Bridge(this@MainActivity), "Android")
if (cacheFile.exists()) {