How to Get URL of FireFox Current Document?

There is a specific KM Action to get the Chrome URL, but I don’t see how to get the FireFox URL.

Any suggestions?

Hey JM,

You can't — at least not directly.

Firefox isn't scriptable — nor does it abide by Accessibility Standards — so you can't use System Events and UI-Scripting to operate on its windows beyond moving them around an resizing them.

That leaves us with brute-forcing the interface.

Activate Firefox
Type Cmd-L
Copy

-Chris

3 Likes

Thanks Chris. As usual, you have a great solution.
Works great. Thanks for all your help.

1 Like

It won't help @JMichaelTX now :frowning: but Cmd+L / Cmd + C is still - in late 2021 - the only way to get the URL.

I wish to point out that OCR is probably another way, as long as the URL doesn't overflow the address bar. Monterey's new OCR is fabulous and probably would work fine for this purpose.

1 Like

I haven't tested these myself but may be of use if wanting to support FF:

1 Like

Very interesting if highly troublesome... :sunglasses:

I can get this to work:

Firefox ⇢ Extract URL from Location Field with UI-Scripting v1.00.kmmacros (7.1 KB)
Keyboard Maestro Export

But it's slow, ugly, and noisy...

The shell script stuff looks really troublesome and perhaps not too secure...

-Chris

1 Like

Cmd+L + Cmd+C works in my automation, perhaps with a small delay.

(I use the result in a regex to confect a file name. In my case it's a localhost URL that I need to deconstruct - to save a graphic away.)

1 Like