Interaction with a local web page?

Hi guys I’m not sure if this is possible…
I’m currently working on an Apple Shortcut which as part of its operation creates a ‘local’ web page consisting of a main HTML file which in turn displays a local image file and other data.

That all works wonderfully…

However, the next stage I’d be looking at would be:

  • The web page to be edited contain ‘YES proceed / STOP’ buttons. No ideas how to do that in HTML.
  • While the shortcut is still running, it then displays the web page
  • It then waits for one of the buttons to be pressed, depending on what has been pressed it closes the web page and then continues to undertake the takes appropriate action.

I know I can likely just display the web page, close it and then use an alert box giving the option to proceed, but the above would be much more elegant if it can be achieved :slight_smile:

Is any of that feasible to engineer?

Any thoughts appreciated.

  • The web page to be edited contain ‘YES proceed / STOP’ buttons. No ideas how to do that in HTML.

That’s just standard HTML - either text links or graphic objects. Nothing special here. You’re already displaying images in the page, so the YES/STOP buttons are just more images, no?

  • While the shortcut is still running, it then displays the web page

OK… no problem here.

  • It then waits for one of the buttons to be pressed, depending on what has been pressed it closes the web page and then continues to undertake the takes appropriate action.

Nope. Not without lots of hoops.

There is no way for the shortcut to detect which object in the page was clicked.
The web page is not going to reach out to Shortcuts and send it a direct message, but you might be able to craft an indirect solution.

All interaction on the page will be via JavaScript, so it’s conceivable that you could write some JavaScript attached to the YES/STOP buttons that changes some state of the page, and that state could be something Shortcuts detects. Shortcuts just sits in a loop looking for the change in question.

Ideally it would be something subtle, like having the JavaScript change the TITLE of the page, or change the HIDDEN property of the button - something that Shortcuts can detect by querying the document via JavaScript. That’s where I’d start.

Thanks for all the responses, it’s appreciated.
As you say, it’s the third stage that would be the issue. Opening the web page and then putting an alert up on screen is working well enough so I’ll shelve this idea :slight_smile: