Skip to content

Instantly share code, notes, and snippets.

@jasmas
Created December 10, 2014 06:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasmas/30ea8c3051f5529cf910 to your computer and use it in GitHub Desktop.
Save jasmas/30ea8c3051f5529cf910 to your computer and use it in GitHub Desktop.
ToSafari.py
# 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'
else:
url = sys.argv[1]
webbrowser.open('safari-' + url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment