Firefox Execute Bookmarklet Javascript

firefox
javascript

#1

Keyboard Maestro “Firefox Execute Bookmarklet Javascript Test” Macro

Firefox Execute Bookmarklet Javascript Test.kmmacros (2.9 KB)


Pressing a button in Google Chrome or Firefox web page using applescript
How to I Use KM to Create FireFox JavaScript Bookmarklet?
How to I Use KM to Create FireFox JavaScript Bookmarklet?
Find text on a page and click next to it
#2

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


#3

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.

UPDATE:

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

With that change, your macro works.


#4

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
    OR
  2. TYPE "javascript:", then PASTE the actual script.

Here's my revised macro:

###Example Results

###MACRO:   Firefox Execute Bookmarklet Javascript Test @JMichaelTX

~~~ VER: 1.0    2017-07-28 ~~~

####DOWNLOAD:
Firefox Execute Bookmarklet Javascript Test @JMichaelTX.kmmacros (3.2 KB)
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.



#5

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?


#6

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.


#7

Maybe 8.0 will offer some help.


#8

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


split this topic #9

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