Jump to content

'Run Javascript…' Automation in 'Web Apps'?


Recommended Posts

Posted

I'm really enjoying how you can use safari to create self contained Web Apps that behave (kind of) like normal desktop apps.

But I can't seem to get any of Alfred's Run Javascript automations to target the web app.

For example, I have made a web app for my self hosted big-AGI… and I want to run a javascript snippet in there. Ive tried the various options under "Frontmost browser" and "Webkit browsers" but no luck. Does anyone have any pointers if this is even possible? 

Posted

Thanks for pointing me in that direction @Stephen_C, but I can actually provide a solution to that problem, by either Velja or a Terminal command 

 

For context, the contents of the referenced post:

Quote

 

That is not doable in the current state of Safari web apps. Those aren’t regular apps (do a “Show Package Contents”, they’re quite simple) and don’t seem to be ready to open with any arbitrary URL (required to open the specific page or search) which makes sense from a security standpoint. Plus, they have auto-generated bundle identifiers with random UIDs in them which wouldn’t make them conductive to automation even if possible.

 

That’s something which can only be changed from Apple’s side, but at the moment it seems unlikely that will change since their choices seem to be deliberate.

 

 

But I am able to open links into a web app without issue using the following terminal command

open -a "Claude" "https://claude.ai/projects"

 

This only seems to work if the requested domain is the same as the web app. For example attempting to open google.com in my Claude.app will bounce me over to Safari.

 

None of this suggests executing javascript will work… but it maybe idea isn't quite dead in the water, just yet

Posted

From my understanding, web apps are supposed to be sandboxed and locked down. You haven't been able to target web apps because they're designed to block rogue JavaScript and restrict accessing resources to their intended domain. Their purpose isn't automation or customizability, it's to provide an app-like experience without actually being an app.

 

You might be able to find a third-party browser/tool that mimics the behaviour of web apps while still retaining browser functionality, but without the browser, web apps are just an interface.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...