This subroutine fetches the URL of the currently displayed Web page in the Firefox Web browser and, optionally, the page’s title. Firefox does not support Applescript and so cannot be supported by Keyboard Maestro’s built-in methods.
Pass the following text strings to this subroutine: “no” if no, you do NOT want it to fetch the title of the current tab; or any other text value if you do (e.g. “yes”). The subroutine returns the following text string: the page title followed by the URL on a new line. The page title will be omitted if the input parameter is “no”.
Please see the "Readme" comment at the top of the macro for details.
Why it's a subroutine: I have a macro that calls this and other subroutines for handling various browsers, but that macro is too attuned to my way of working to be worth sharing without a lot of guesswork about other users’ needs.
Good thinking using the page info window to get the details. On your macro that I downloaded it looks like your summon the page info window action is simulating the keystroke of cmd+C? That doesn't work for me to bring up the page info window.
You can simplify this by getting the window title with AppleScript:
tell application "System Events"
tell application process "Firefox"
tell (first window whose subrole is "AXStandardWindow")
set windowTitle to its name
set kmInstance to system attribute "KMINSTANCE"
tell application "Keyboard Maestro Engine"
setvariable "local_FirefoxWindowTitle" instance kmInstance to windowTitle
And then Cmd-L, Cmd-C to capture the URL to the clipboard.
I was hoping to be able to extract the URL from the location field with UI-Scripting via System Events, but Firefox still doesn't use proper coding for usability.
Ah, that explains it, thanks. Although I didn't need to turn on VO to get your script to work in a test macro (I just double-checked that in a new test macro).
Yes, so I vaguely remembered, also that its return has optimistically been an "issue" for many years now.
Maybe they are insufficiently motivated (is that different? ). These days (across all platforms) Safari is six time more popular than Firefox, so maybe allocating resources specifically for Mac support is seen as expensively supporting a niche within a declining niche... I don't know. I still have occasional reasons to use or at least test Firefox (that's why I put this subroutine together) but it's not an attractive option for Mac, is it.