mirror of
https://github.com/AeThex-Corporation/AeThex-OS.git
synced 2026-04-25 17:37:19 +00:00
fix(webview): test loading external js file relative to html
This commit is contained in:
parent
61ce24a320
commit
213efdeb71
3 changed files with 31 additions and 2 deletions
26
android/app/src/main/assets/public/test_external.html
Normal file
26
android/app/src/main/assets/public/test_external.html
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no, viewport-fit=cover" />
|
||||||
|
<title>Test External Script</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: pink; /* Start Pink, turn Cyan on success */
|
||||||
|
color: black;
|
||||||
|
font-size: 40px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
height: 100vh;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
<h1>TEST EXTERNAL (Pink = Wait / Cyan = Success)</h1>
|
||||||
|
</div>
|
||||||
|
<!-- Load the external script -->
|
||||||
|
<script src="test_script.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
3
android/app/src/main/assets/public/test_script.js
Normal file
3
android/app/src/main/assets/public/test_script.js
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
console.log("External script loaded");
|
||||||
|
document.body.style.backgroundColor = "cyan";
|
||||||
|
document.body.innerHTML = "<h1>EXTERNAL SCRIPT WORKS (Cyan)</h1>";
|
||||||
|
|
@ -71,7 +71,7 @@ public class MainActivity extends BridgeActivity {
|
||||||
webView.clearCache(true);
|
webView.clearCache(true);
|
||||||
webView.clearHistory();
|
webView.clearHistory();
|
||||||
|
|
||||||
// LOAD THE RED FILE
|
// LOAD THE EXTERNAL SCRIPT TEST
|
||||||
webView.loadUrl("file:///android_asset/public/test_red.html");
|
webView.loadUrl("file:///android_asset/public/test_external.html");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue