Tell Safari to open current page in another browser?

I'm trying to right a script to run as a service in Safari that opens the current page in Firefox. I have this one that works for Chrome. I tried subbing out "Google Chrome" for Firefox but that doesn't work.

on run {input, parameters}
	
	tell application "Safari"
		set theURL to URL of current tab of window 1
	end tell
	
	tell application "Google Chrome"
		if (count of (every window where visible is true)) is greater than 0 then
			tell front window
				make new tab
			end tell
		else
			make new window
		end if
		set URL of active tab of window 1 to theURL
		activate
	end tell
	
	return input
end run

iMac 21.5″, macOS 13.2

Posted on Feb 27, 2023 7:41 AM

Reply
Question marked as Top-ranking reply

Posted on Feb 27, 2023 10:57 AM

Unlike Safari, Mozilla does not provide AppleScript scripting dictionary support for Firefox. So as Tony T1 alludes,

one must do the following to open the URL in Firefox:


use scripting additions

tell application "Safari"
	set theURL to URL of current tab of window 1
end tell

do shell script "open -a Firefox " & theURL
return

Similar questions

7 replies
Question marked as Top-ranking reply

Feb 27, 2023 10:57 AM in response to PaperWeight

Unlike Safari, Mozilla does not provide AppleScript scripting dictionary support for Firefox. So as Tony T1 alludes,

one must do the following to open the URL in Firefox:


use scripting additions

tell application "Safari"
	set theURL to URL of current tab of window 1
end tell

do shell script "open -a Firefox " & theURL
return

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Tell Safari to open current page in another browser?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.