Run local HTML file and its embedded javascript in WebView

Hi all, has anyone tried running a local html file inside a WebView and have all its JS run? Basically making the loaded HTML file intractable. I’m trying to make an ios shortcut that loads a local html file inside a webview where I can use it like a simple webapp. Similar to what this app is doing ‎HTML Viewer Q on the App Store …but much simpler.

Thanks in advance :blush:

1 Like

Have you tried using WebView.loadFile(path)? You need to pass it the full file path like with all FileManager functions.

If you’re constructing the HTML on the fly, then you also could use WebView.loadHTML(html).


Yep I have tried it and it shows the html file just fine. The issue I’m having with it is that all the javascript included in the file stopped working completely.

Has it stopped after the update to iOS 15? If yes, then this might have to do something with the WebView.evaluateJavaScript bug.

1 Like

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 = `

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

setTimeout(do, 1000)

function do() {

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

1 Like

I’m looking into this with high priority and hope to have a fix soon. It’s a bit more tricky than I expected. Realistically it might take a week or so until I have a fix. I hope for your patience :pray:


Thank you so much for investigating further on this :blush:… To answer your question, no I have not updated to iOS 15… im running my code on ios 14.8 and 14.7.

Thanks @simonbs! Also <input type="date"> is not working inside the webview. Is this normal behaviour or is this some how connected to the bug you are fixing?

That shouldn’t have anything to do with the issue I’m working to fix. The WebView is backed by Apple’s WKWebView that’s part of WebKit. I’d expect it to handle date inputs properly.

Got it. Strange though that the date input I have on my html file also seemed to stop working*(not showing the date picker ui)* when loaded inside a webview. I might do a bit more test on this when I have spare time.

Hello! I know it’s been some time but I’m facing the same issue. Running above script will do nothing for me either.
I’m on iOS 15.1 and Scriptable version 1.6.11.

Not to mock your English but when you say “intractable” I think you mean “interactive” as in “the user can interact with this”. Correct?

1 Like

Is already running fine on my end, but I am still on iOS 14.8.1

Then it’s prolly related to iOS 15.1