How are you interacting with the WebView?


With 1.1 you can access the WebView. However, you can’t return HTMLNodes. This is the pattern I came up to return data from a DOM selector.

w = new WebView();
await w.loadURL("");

var getData = `
  function runit() {
    var p = document.querySelectorAll('p');
    var res = p.forEach(item => { res.push(item.innerHTML); });
    return res;

let response = await w.evaluateJavaScript(getData);

Does anyone have an alternate way of returning DOM data from the WebView?


Hi Scott,

I have taken your code and made a bit of change. Now it will get “the word of today” (in Danish) and return it into response- hope you can use it.

const webview = new WebView();
await webview.loadURL("");

var getData = `
  function runit() {
    const ord = document.querySelector('.dagensord .match').innerText;
    const lemklas = document.querySelector('.dagensord .lemklas').innerText;
    const definition = document.querySelector('.dagensord .definition').innerText;
    return (ord + ' (' + lemklas + ') \\n' + definition);


let response = await webview.evaluateJavaScript(getData, false);

split this topic #3

4 posts were split to a new topic: User Input (to function parameters)


Does anybody know, wheter it is possible to display app content with webview or not? Im thinking of using the x-callback-url action as input url. But then I’m stuck b/c its obviously not an html…:exploding_head:


I’m sorry, I don’t understand.Do you mean to display content from another app in the WebView? you can launch Scriptable with an url scheme and pass data that way, but it has to be encoded.

If you wanted to load the url in the WebView, you’re out of luck, because that won’t work.