All-in-One Health & Fitness Dashboard

A Better Chrome To Safari Bookmarklet



In January, I tried to put together a bookmarklet to send the webpage currently open in Google Chrome for iOS to Apple’s Safari. That turned out to be a surprisingly complex effort as Google didn’t think offering an “Open In Safari” option would be a good idea, and the app’s URL scheme produced some interesting results when opening and closing Chrome.

I was reminded of the bookmarklet this morning by reader @CNWLshadow, and I realized that I never posted the solution I settled with. It consists of a browser bookmarklet and a Pythonista script, and it works with just one tap.

With Pythonista 1.3, developer Ole Zorn added the possibility to open links specifically in Safari by prefixing them with safari-, therefore allowing me to create a simple bookmarklet that would:

  • Take the current URL open in Chrome;
  • Give it to Pythonista;
  • Open it in Safari.

The bookmarklet is extremely basic. It assumes a script called “ToSafari” is available in the root of Pythonista, and it sends an argument for the webpage that is currently open. You can copy the code below and add it to Chrome as a bookmark.


The script is simple as well. It starts by counting the arguments sent to the script: if less than two, it will print that no URL was received; else, it will take the URL and send it to Safari by prefixing it with safari-.

# Receives a URL via JS bookmarklet and sends it to Safari
# Bookmarklet: javascript:window.location='pythonista://ToSafari?action=run&argv='+encodeURIComponent(document.location.href);
# Assumes script is in the root of Pythonista and called 'ToSafari'

import sys
import webbrowser

numArgs = len(sys.argv)

if numArgs < 2:
    print 'No URL was received'
    url = sys.argv[1]'safari-' + url)

Once set up, the script takes around 6 seconds to be executed on my iPad mini from a cold start (Pythonista force-quit from the multitasking tray), 1 second if Pythonista is in the background. While it isn’t the best solution, I think this is an acceptable compromise to get a working Chrome-to-Safari bookmarklet that doesn’t require any further manual operation.

Unlock MacStories Extras

Club MacStories offers exclusive access to extra MacStories content, delivered every week; it’s also a way to support us directly.

Club MacStories will help you discover the best apps for your devices and get the most out of your iPhone, iPad, and Mac. It’ll also give you access to advanced iOS shortcuts, tips and tricks, and lots more.

Starting at $5/month, with an annual option available.

Join the Club.

A Club MacStories membership includes:

  • MacStories Weekly newsletter, delivered every week on Friday with app collections, tips, iOS workflows, and more;
  • MacStories Unplugged podcast, published monthly with discussions on what we’re working on and more;
  • Monthly Log newsletter, delivered once every month with behind-the-scenes stories, app notes, personal journals, and more;
  • Access to occasional giveaways, discounts, and free downloads.