Hello everyone. I wrote the following script to get the HTML of a specified URL:
/* Given a URL, return the HTML */
var URLAlert, URLText = "";
var webView, html;
var noninteractive;
if (args.plainTexts.length > 0) {
URLText = args.plainTexts[0];
noninteractive = true;
}
else if (args.urls.length > 0)
{
URLText = args.urls[0];
noninteractive = true;
}
else if (args.shortcutParameter)
{
URLText = args.shortcutParameter;
noninteractive = true;
}
else {
noninteractive = false;
URLAlert = new Alert();
URLAlert.title = "URL";
URLAlert.message = "Please enter the URL:";
URLAlert.addAction("OK");
URLAlert.addCancelAction("Cancel");
URLAlert.addTextField("URL");
let alertIndex = await URLAlert.presentAlert();
if (alertIndex >= 0) {
URLText = URLAlert.textFieldValue(0);
}
}
if (URLText != "") {
webView = new WebView();
await webView.loadURL(URLText);
await webView.present(true);
let html = await webView.getHTML();
if (noninteractive) {
Script.setShortcutOutput(html);
}
else {
await webView.present();
await QuickLook.present(html);
}
}
Script.complete()
I don’t know why, but when I try using it with a URL such as the one below [1], the script produces the error in the photo below. I think it is a general problem because the script does not work with any URL and when it reports an error, it is always the same error. Might someone know why I am getting this error message and what I need to do to remove it? I am running iOS 16.5.1 on an iPhone 8 Plus. I’d really appreciate any help. Thanks so much.
[1] [For the... - Bible and Spirit of Prophecy Daily Portions | Facebook