Improved Firefox.app scripting

Here I invite the attention of users to participate in the disclosure of the hidden features of FireFox.app. Some of them have already been revealed to me. Along the way, I will improve my post further.
.

property firefoxUtil : "/Applications/Firefox.app/Contents/MacOS/firefox"

openURL_in_NewTab("https://translate.google.gr/?hl=el")

-- do shell script firefoxUtil & " --wait-for-jsdebugger > /dev/null 2>&1 &" -- Spin event loop until JS debugger connects
-- do shell script firefoxUtil & " --private-window " & theURL & " > /dev/null 2>&1 &" -- open URL in a new private window
-- do shell script firefoxUtil & " --kiosk > /dev/null 2>&1 &" -- Start the browser in kiosk mode
-- do shell script firefoxUtil & " --setDefaultBrowser > /dev/null 2>&1 &" -- open the confirm dialog to set as default browser
-- do shell script firefoxUtil & " --new-instance > /dev/null 2>&1 &" -- useless
-- do shell script firefoxUtil & " --safe-mode  > /dev/null 2>&1 &" -- Disable extensions and themes for this session
-- do shell script firefoxUtil & " --no-remote  > /dev/null 2>&1 &" -- Do not accept or send remote commands; implies
-- do shell script firefoxUtil & " --migration  > /dev/null 2>&1 &" -- open with Migration Wizard
-- do shell script firefoxUtil & " --ProfileManager  > /dev/null 2>&1 &" -- open Profiles Manager to edit
-- do shell script firefoxUtil & " --search " & quoted form of searchTerm & " > /dev/null 2>&1 &" -- Search <term> with your default search engine

on printHelp()
	do shell script firefoxUtil & " -h"
end printHelp

on getVersion()
	do shell script firefoxUtil & " --version"
end getVersion

on getFullVersion()
	do shell script firefoxUtil & " --full-version"
end getFullVersion

on openJsConsole()
	do shell script firefoxUtil & " --jsconsole > /dev/null 2>&1 &"
end openJsConsole

on openFirefoxPreferences()
	do shell script firefoxUtil & " --preferences > /dev/null 2>&1 &"
end openFirefoxPreferences

on openURL_in_NewWindow(theURL) -- (full screen window)
	do shell script firefoxUtil & " --new-window " & theURL & " > /dev/null 2>&1 &"
end openURL_in_NewWindow

on openURL_in_NewTab(theURL)
	do shell script firefoxUtil & " --new-tab " & theURL & " > /dev/null 2>&1 &"
end openURL_in_NewTab

Not really hidden, but well-documented :wink:

https://wiki.mozilla.org/Firefox/CommandLineOptions

1 Like

Yes, it’s rather strange. I’ve often seen users asking questions about Firefox, and there’s always someone who claims Firefox isn’t scriptable, and no one has offered a helpful link to the documentation.

Once again I was mistaken in thinking that I rediscovered America, following the example of the Vikings and Christopher Columbus. :grinning:

No worries. I’m so old that I used to talk to Firefox on the command line on Linux :wink: Also, I wouldn’t exactly call that “scriptable” – it’s very, very limited to opening URLs in FF. You can’t even send JavaScript to it that way, as you can with Safari.

1 Like