Skip to content

Instantly share code, notes, and snippets.

@zaosoula
Created January 27, 2023 00:32
Show Gist options
  • Save zaosoula/0bb4741023bdccf5dd080a9fcb9ea1d3 to your computer and use it in GitHub Desktop.
Save zaosoula/0bb4741023bdccf5dd080a9fcb9ea1d3 to your computer and use it in GitHub Desktop.
Scriptable's WebView with externals links opening in Safari
const view = new WebView();
view.shouldAllowRequest = request => {
if(request.url.startsWith("http")) {
Safari.open(request.url);
return false;
}
return true;
}
await view.loadHTML(/* html */`
<html>
<body>
<a href="https://github.com/zaosoula">Open in Safari<a>
</body>
</html>
`);
await view.present();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment