Firefox Execute Bookmarklet Javascript

Keyboard Maestro “Firefox Execute Bookmarklet Javascript Test” Macro

Firefox Execute Bookmarklet Javascript Test.kmmacros (2.9 KB)

1 Like

Aargh! The filter variable should, of course, be %variable%Javascript% .

Martin, did you test your macro? Even with the correction it does not work for me.
I'm running FireFox 54.0.1 (5417.6.28) on macOS 10.11.6.

As best I can tell, you have to first create a Bookmark with the JavaScript script, then click on that Bookmark.


You can't insert by pasting. You have to TYPE:

With that change, your macro works.

Martin, as I mentioned above, your macro does not work for me.

However, it does work, if you make EITHER of these changes:

  1. TYPE the entire JavaScript script
  2. TYPE "javascript:", then PASTE the actual script.

Here's my revised macro:

##example Results

##Macro Library   Firefox Execute Bookmarklet Javascript Test @JMichaelTX

<a class="attachment" href="/uploads/default/original/2X/2/288b672fe18f66a3d5e319de37b78bd505dedd28.kmmacros">Firefox Execute Bookmarklet Javascript Test @JMichaelTX.kmmacros</a> (3.2 KB)
**Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.**


<img src="/uploads/default/original/2X/a/adf0aa28ceadafb945c567a82a3f99e821fd5cd8.png" width="465" height="966">

OK, here’s a follow-up, for anyone:

Now that we know how to execute a JavaScript in Firefox from KM, how do we return results to KM?

Let’s say I create a JSON string, or any string actually, how do I get that into KM, or even the Clipboard?

Any ideas?

Actually I did test with Paste. It worked for me. I had previously used Type but got impatient: A non-trivial script would take a long time to type.

As for returning results I can only think of using a localhost web server to tickle KM. Luckily each Mac comes with one. But this would be a pain to use.

Maybe 8.0 will offer some help.


That's why I switch to just typing "javascript:" and then pasting the actual script:

A post was split to a new topic: How to I Use KM to Create FireFox JavaScript Bookmarklet?