[Safari] How can I quickly open the current page in Chrome?

Discussion in 'Mac Apps and Mac App Store' started by iRock1, Feb 16, 2014.

  1. iRock1 macrumors 6502a


    Apr 23, 2011
    Right now I have to go through Develop > Open Page With > Google Chrome. What I need though is to do the same using a keyboard shortcut.

    One option would be assigning a keyboard shortcut to that menu in the Keyboard Preferences Pane. However, the menu includes the app version, so I'd need to modify the keyboard shortcut every time Google Chrome updates.

    Maybe I could use the AppleScript Editor or Automator to create a new service and then use FastScripts? If so, what should I write? Because my knowledge of scripting is almost zero. :p
  2. Weaselboy Moderator


    Staff Member

    Jan 23, 2005
    This Applescript will open the front Safari window in a new Chrome tab.

    I launch it from Alfred as a "workflow", but Fastscript should do the trick also.

    if application "Safari" is running then
    	tell application "Safari"
    			set currentSafariURL to URL of current tab of front window
    			set pageName to name of current tab of front window
    		on error
    			return "There are no pages open in Safari at the moment"
    		end try
    	end tell
    	tell application "Google Chrome"
    		# If Chrome has no windows open make a new window
    		if (count of windows) is 0 then make new window
    		set currentChromeURL to URL of active tab of front window
    		# Don't do anything if the page is already open in Chrome
    		if currentChromeURL is not currentSafariURL then
    			# If the active tab is in use make a new tab
    			if currentChromeURL is not "chrome://newtab/" then
    				make new tab at end of tabs of front window
    			end if
    			# Open the URL from Safari
    			set URL of active tab of front window to currentSafariURL
    			return "The current Safari tab is already open in Chrome"
    		end if
    	end tell
    	# Enable the following line to post notifications after sending URLs to Chrome
    	--return "Opening '" & pageName & "' in Chrome"
    	return "Safari is not open at the moment"
    end if
    Credit to the author of the Alfred workflow here.
  3. iRock1 thread starter macrumors 6502a


    Apr 23, 2011
    It works wonderfully. I just saved it as a script, then assigned it a keyboard shortcut with FastScripts and voilâ!


Share This Page