Created
January 27, 2023 00:32
-
-
Save zaosoula/0bb4741023bdccf5dd080a9fcb9ea1d3 to your computer and use it in GitHub Desktop.
Scriptable's WebView with externals links opening in Safari
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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