Search code examples
macosfirefoxapplescript

MacOSX or AppleScript: get current URL from Firefox


How can I get the current URL from Firefox (3 or 4)? All solutions I have found so far either don't work (e.g. those with "class curl") or are ugly hacks which are no solution for me (sending key presses to copy the URL to clipboard).


Solution

  • Well, I have one solution now: I am reading it out of the current session store of Firefox. This works but it is always up to 10 seconds out-of-date.

    Here is the code: https://github.com/albertz/foreground_app_info/blob/master/mac/app-scripts/url%20of%20Firefox.py