Even using the example I couldn't get a snippet of JS (alert("hello")) to function via KM even though it executed in the console. So, I'm a bit stumped.
Try the following - in increasing order of ambition:
“Baby steps” such as the above is what I do when trying to work in a new environment.
Let us know how you get on.
[Edit just removed a stray apostrophe; I do know the difference between “its” and “it’s”. ]
I don't think you will be able to do that in FF. Many of us in the forum have long looked for ways to script FF and have never found a method that reliably works for complicated scripts. So, if you need to click on a specific element in the web page, I'd suggest:
Not to start a browser war, but I use Firefox because of its better handling of HTML 5 canvas...
... You can directly turn it into a PNG graphic from a context menu.
I don't know if that is flexible enough for you.
No but I should imagine it’s a matter of creating a bookmark for any page, navigating to edit it and pasting in. NOT simple.
I think this is the way it’s done on iOS / Mobile Safari, too.
It uses the default keyboard shortcuts for opening and closing the developer tools views, so if you have modified them you'll have to change those parts of this sample macro.
(I wish I'd thought of this technique earlier, because I think I could make good use of this myself… )
Thanks for sharing.
That's a very clever idea to use a KM URL trigger.
You can use the Keyboard:Shortcuts option in the System Preferences Keyboard preference pane. Select App Shortcuts, then click the plus button, choose Firefox, and add the exact name of the bookmarklet you want to execute. This may only work with bookmarklets that are in the Bookmarks Toolbar.
Even though I am web developer, this was not my first idea, but then I gave it a tests and it works (at least for me) like a charm.
Here is an example of a macro I use to capture the text in a list of items and then format it as a markdown list and paste it on the active input (also in Firefox).
Wow! That is really thinking out-of-the-box!
Just to make it easier for others to get started, would mind also posting the macro file?
Sure! Let me think of a quick, more general example, and I'll post the file.