Hi there,
Thanks for the great app!!
I’m trying to launch shortcuts from a WebView page. Is it possible?
The URL scheme doesn’t seem to be recognized:>
var output = `<HTML>
<HEAD>
<TITLE>My first HTML document</TITLE>
</HEAD>
<style>
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 60px;
}
</style>
<BODY>`
output = output
+ ` <a href="shortcuts://">tap here to launch shortcuts✅</a>`
output = output
+ ` </BODY>
</HTML>`
var w = new WebView();
w.loadHTML(output);
w.present();
1 Like
It seems like that also deep links are not working (for example links to apps in the AppStore).
A workaround is to add this piece of code before presenting the WebView:
w.shouldAllowRequest = (request) => {
if (!request.url.startsWith("http") && request.url !== "about:blank") {
Safari.open(request.url);
return false;
}
return true;
}
If you want to open any deep links, you would have to add them in the if
condition.
1 Like
Ooooh thanks for your answer!
In the meantime I switched to a shortcuts based solution. Not pretty but that does the job. And it keeps the code more legible for the amateur coder that I am.
But I will definitely consider implementing your solution as I prefer to remain within scriptable as long as possible for speed reasons