omz / Pythonista-Issues

Issue tracker for Pythonista (iOS)
168 stars 14 forks source link

Javascript action extension support in safari #497

Open marcigo36 opened 6 years ago

marcigo36 commented 6 years ago

It would be great to have the ability of running javascript code in safari from an action extension

zrzka commented 6 years ago

@marcigo36 can you elaborate more? Not sure what do you mean exactly. Action extension -> Run Pythonista, which runs JavaScript? Or?

marcigo36 commented 6 years ago

One can modify the content of a web page in safari, using Javascript injection. Like what is described here in the ‘Accessing a Webpage’ section.

This would allow modifying webpage data in a convenient way, and it even lets you communicate with the action extension code. The injected javascript object can extract and send multiple types of data to the host extension, like dictionaries, images, etc.

Unfortunately Apple forces you to define the injected js code in advance, but you can overcome this by using eval().