Return to Home Screen

Apologies if answered previously.

Is there an easy way to return to the home screen (i.e. exit Sciptable) after displaying a website (using for example stack.url in a widget)?

Have tried App.close(), SpringBoard() & Script.complete() with no success.

thanks.

It doesn’t work because the script is suspended once Scriptable goes out of focus.
What you can do is use Scriptable to view the webpage instead of opening in Safari.

Here’s how I would do it

view-url.js

const url = args.queryParameters.url
const vw = new WebView()
vw.loadURL(url)
await vw.present(true)
App.close()

my-widget.js

const widget = new ListWidget()

const linkStack = widget.addStack()
linkStack.url = `scriptable:///run/view-url?url=${encodeURIComponent('https://apple.com')}`
const link = linkStack.addText('Apple')
Script.setWidget(widget)

1 Like