Run local HTML file and its embedded javascript in WebView

I’ve tested it myself right now and it doesn’t work even on iOS 14.6.

Maybe @simonbs can please have a look?

I’ve used this script, but nothing happens on tapping the button.

const script = `
<html>
<body>
test

<button onclick="do">click</button>

<script>
setTimeout(do, 1000)

function do() {
  alert("test")
  console.log("test")
}
</script>
</body>
</html>
`;

const fm = FileManager.local();
const file = fm.cacheDirectory() + "/htmltest.html";
fm.writeString(file, script);
const wv = new WebView();
wv.loadFile(file);
await wv.present();

fm.remove(file);
1 Like