Skip to content

Instantly share code, notes, and snippets.

@Angles
Last active October 8, 2023 18:57
Show Gist options
  • Star 41 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save Angles/3180144 to your computer and use it in GitHub Desktop.
Save Angles/3180144 to your computer and use it in GitHub Desktop.
"Open In" Bookmarklets for iOS
/* WITH MODS TO ORIG -- iOS Browser Bookmarklets to launch other apps and stuff */
/* ver 2014-04-14a */
/* backing up my "Open In" bookmarks */
// note iOS6 requires some changes to these
// BEGIN TESTING STUFF -- IN PROFRESS LIKELY NOT WORKING
// SOME WORK, MOST tests are not WORK --
// PINNER APP TEST STUFF (as a private one)
// the page title as the title and your selected text as the description.
// set be private with +&shared=0 before semicolon at end
javascript:q=location.href;if(document.getSelection)%7Bd=document.getSelection();%7Delse%7Bd='';%7D;p=document.title;window.location='pinner://bookmark?href='+encodeURIComponent(q)+'&extended='+encodeURIComponent(d)+'&title='+encodeURIComponent(p)+'&shared=0';
// pinner x-callback to safari same private as above
// bookmarklet to automatically take you back to your browser after adding a bookmark. For example, in Safari:
javascript:q=location.href;if(document.getSelection)%7Bd=document.getSelection();%7Delse%7Bd='';%7D;p=document.title;window.location='pinner://x-callback-url/bookmark?x-source=Safari&x-success='+encodeURIComponent(q)+'&x-cancel='+encodeURIComponent(q)+'&href='+encodeURIComponent(q)+'&extended='+encodeURIComponent(d)+'&title='+encodeURIComponent(p)+'&shared=0';
// pinner private x-success to iCab TEST
// x-source [string, optional] : A friendly name for the app making the call. It will be displayed to the user to identify the request.
javascript:q=location.href;if(document.getSelection)%7Bd=document.getSelection();%7Delse%7Bd='';%7D;p=document.title;window.location='pinner://x-callback-url/bookmark?x-source=iCab&x-success=icabmobile://&x-cancel=icabmobile://&href='+encodeURIComponent(q)+'&extended='+encodeURIComponent(d)+'&title='+encodeURIComponent(p)+'&shared=0';
// END TESTING STUFF
// SAVE AS PDF STUFF -- VARIOUS WAYS
// PDFmyURL into Goodreader
javascript:location.href='ghttp://pdfmyurl.com?url='+encodeURIComponent(location.host+location.pathname+location.search+location.hash);
// PDFmyURL prompt name to GR
javascript:s=prompt('Use%20this%20file%20name:');if(s)%7Bfn='&--filename='+s+'.pdf'%7Delse%7Bfn=''%7D;void(location.href='ghttp://pdfmyurl.com?url='+encodeURIComponent(location.host+location.pathname+location.search+location.hash)+fn);
// generic PDFmyURL into browser window
javascript:location.href='http://pdfmyurl.com?url='+encodeURIComponent(location.host+location.pathname+location.search+location.hash);
// Web2PDF // TEST1
javascript:location.href=
'http://www.web2pdfconvert.com/engine?cURL='+escape(location.href)+'&title='+escape(document.title);
// NOT WORKING Meke PDF joliprint // TEST2
// javascript:location.href='http://api.joliprint.com/api/rest/url/print/s/joliprint.com?url='+encodeURIComponent(window.location.href)+'&disposition=attachment';
// search xroads.virginia.edu
//https://www.google.com/search?q=site:xroads.virginia.edu+natural+bridge&safe=off&client=safari&hl=en&nota=1&biw=1024&bih=276
// open in chrome
javascript:window.location='googlechrome'+window.location.toString().replace('http','');
// open in photon
javascript:window.location='photon'+window.location.toString().replace('http','');
// Open Source in Textastic -- VERIFY THIS
// Replace http:// with textastic://
javascript:window.location='textastic://'+window.location.toString().replace('http://','');
// Post with Twitterrific MAC OSX fancy (probably iOS too) (title of page and URL)
javascript:window.location='twitterrific:///post?message='+encodeURIComponent('"'+document.title.toString()+'"')+'%20'+encodeURIComponent(location.href.toString())
// Google last 2 yrs from clean URL (ver 1)
javascript:window.location.href=window.location.href+'&tbs=qdr:y2';
// Post with Echofon simple
javascript:window.location='echofon:///message?'+encodeURIComponent(location.href.toString());
// Post with Echofon fancy (title of page and URL) (put /ACCT before the ? to specify account)
javascript:window.location='echofon:///message?'+encodeURIComponent('"'+document.title.toString()+'"')+'%20'+encodeURIComponent(location.href.toString());
// Tweetbot - open user profile in tweetbot default acct (from that profile page in mobile safari)
javascript:window.location='tweetbot://user_profile/'+location.pathname.substring(1);
// Add to Buffer
javascript:void(location.href='bufferapp://?u='+encodeURIComponent(location.href)+'&t='+encodeURIComponent(document.title));
// ZooTool - CLOSED - but JS is interesting
javascript:function ztrl(){var d=document,z=d.createElement('scr'+'ipt'),b=d.body,l=d.location; try { if(!b) throw(0); z.setAttribute('src','http://zootool.com/read-later/js/'); b.appendChild(z); } catch(e) { alert('Please wait until the page has loaded.'); }}ztrl();void(0);
// Add to Clippt bookmarklet for Kippt
javascript:window.location.href='clippt://add?url='+encodeURIComponent(window.location.href);
// Pinboard add bookmark
javascript:q=location.href;if(document.getSelection){d=document.getSelection();}else{d='';};p=document.title;void(open('https://pinboard.in/add?url='+encodeURIComponent(q)+'&description='+encodeURIComponent(d)+'&title='+encodeURIComponent(p),'Pinboard','toolbar=no,width=700,height=350'));
// Add to Readability app
javascript:window.location='readability://add/'+location.href;
// Add to Bookmark-All app
javascript:window.location='com-nuuxo-bookmarkall://save?url='+encodeURIComponent(document.location)+'&title='+encodeURIComponent(document.title);
// subscribe to podcast with Downcast from mobile Safari feed page (pre iOS6)
javascript:window.location='downcast'+decodeURIComponent(location.href).substring(36);
// subscribe to podcast with Downcast from feed burner type page // need to re-verify
javascript:location.href='downcast'+location.href.substring(4);
// OLD, PRE-IOS6 Add RSS feed to Feeddler from mobile Safari feed page
javascript:window.location='feeddler'+decodeURIComponent(location.href).substring(36);
// Feeddler add site (from a web page) subscribe if it finds feed for that site
javascript:location.href='feeddler'+location.href.substring(4);
// open in Opera Mini (handles FTP too)
javascript:window.location='o'+location.href;
// open in puffin - will handle https via puffins
javascript:window.location='puffin'+window.location.toString().replace('http','');
// open in atomic browser
javascript:window.location='atomic://'+location.href.substring(4);
// open in source browser
javascript:window.location='sb:'+location.href;
// open in web talk
javascript:window.location='webtalk://'+escape(location.href.toString());
// save page to GoodReader
javascript:window.location='g'+location.href;
// save video to GoodReader
javascript:(function()%7Bwindow.location.href='g'+(document.getElementsByTagName('video')%5B0%5D.src);%7D)();
// open in perfect browser
javascript:window.location='perfect://'+location.href;
// open in Vanilla surf
javascript:window.location='vsurf://'+location.href;
// open in ICAB - and it handle icabmobiles
javascript:location.href='icabmobile'+location.href.substring(4);
// open in ICAB alternatives: do the same handles https also
javascript:location.href='web'+location.href.substring(4);
// open in ICAB alternative 2: does the same, handles https also
javascript:window.location='web'+window.location.toString().replace('http','');
// Post Tweet with Tweetbot - Fancy version (default acct)
// optionally specify account before the third slash, like tweetbot://ACCTNAME/post ...
javascript:window.location='tweetbot:///post?text=%22'+encodeURIComponent(document.title.toString())+'%22%20'+escape(location.href.toString());
// Post Tweet with Twitter- Fancy version
javascript:window.location='tweetie://post?message=%22'+encodeURIComponent(document.title.toString())+'%22%20'+escape(location.href.toString())
// open web-sniffer for headers and source
javascript:q=escape(document.location.href);void(location.href='http://web-sniffer.net/?url='+q);
// switch to atomic then open at web-sniffer
javascript:window.location='atomic://'+'http://web-sniffer.net/?url='+escape(document.location.href);
// open in site sucker
javascript:document.location.href='sitesucker:'+location.href
// Open Terra Browser
javascript:window.location='terra://'+location.host+location.pathname+location.search+location.hash;
// send URL to Instapaper app
javascript:window.location='i'+location.href;
// other bookmarklets stuff from sites
// format readability
javascript:((function()%7Bwindow.baseUrl='https://www.readability.com';window.readabilityToken='';var%20s=document.createElement('script');s.setAttribute('type','text/javascript');s.setAttribute('charset','UTF-8');s.setAttribute('src',baseUrl+'/bookmarklet/read.js');document.documentElement.appendChild(s);%7D)());
// translate to English
javascript:q=location.href;void(location.href='http://translate.google.com/translate?hl=en&sl=auto&u='+q);
// some complicated ones
// Readability Read Later bookmarklet ( that has your token in it )
/* to get it on iOS:
- use browser with "View Source", ex. Atomic.
- Log in Readability.
- Go here
http://www.readability.com/bookmarklets
- "View Source"
- your "Read Later" bookmark inside textarea class="bookmarklet-input" id="code-ios-save"
- OPTIONALLY
- try to select the text (even if you can't see it), in the "Read Later" textbox, copy it to get bookmarklet
*/
// Open Wikipanion
// ( eg from http://en.wikipedia.org/wiki/Simak we need wiki://en.wikipedia.org/wiki/Simak )
// Solution 1: (works!)
javascript:window.location='wiki://'+window.location.toString().replace('http://','');
// Solution 2: (I like the above better)
javascript:window.location='wiki://'+location.host+location.pathname;
// Solution 3 is same except can handles query if any exists
javascript:window.location='wiki://'+location.host+location.pathname+(location.search?location.search:'');
// Open Talk:Wikipanion
// (eg from http://en.wikipedia.org/wiki/Simak we need wiki://en.wikipedia.org/wiki/Talk:Simak
javascript:window.location='wiki://'+location.host+location.pathname.toString().replace('/wiki/','/wiki/Talk:');
// ** NOTE this DOES work MOSTLY, except where the main page is a redirect, then the talk page link in Wikipedia is a link to the original URL with Talk: added, not the redirect one.
// ** SO the above Simak example FAILS because the real URL is http://en.wikipedia.org/wiki/Clifford_D._Simak
// Twittelator Pro example from URI website // TESTING
// twit:///post?message=Twittelator%20Pro%20rocks%20the%20house
// Post with Twittelator Pro simple
javascript:window.location='twit:///post?message='+encodeURIComponent(location.href.toString());
// Post with Twittelator Pro fancy
javascript:window.location='twit:///post?message=%22'+encodeURIComponent(document.title.toString())+'%22%20'+escape(location.href.toString());
// *** Some JS Snippets (used in open URI) -- noob info
/*
-- Notes on window.LOCATION object --
-- This site had good explanation & examples --
http://tundrablue.com/development/javascript/WindowLocation.html?SearchParameter=true#HashID
LOCATION object has the whole URL, as a string via .toString() OR its struct parts (they're already strings).
.HREF has the whole URL too, already a string.
.PROTOCOL has http: ftp: file: but NEVER the "//" after it
.HOSTNAME gives the "www.bla.com" never gives port,
location.toString() and l.href are full URL with "//" BUT parts l.protocol +"//"+ l.hostname we must add it
.HOST like hostname but will include a port if any is specified. If no port, .host and .hostname are the same.
.SEARCH, if there, is ?andTheStuff+Following+It
.HASH usually is an anchor in the page #top if it's there, the # included, it generally comes after the ? If it exists
*/
// * minimalist good enough reconstruction of href URI is:
location.protocol+'//'+location.host+location.pathname+location.search+location.hash;
// * RARELY you'll come across a URL with lots of stuff in it, and trying to post it to a twitter via the URI schemes may require encodeURIcomponent()
// YES here's an example, I had to change 1st escape to encodeURIcomponent in Post Tweetie Fancy
javascript:window.location='tweetie://post?message=%22'+encodeURIComponent(document.title.toString())+'%22%20'+escape(location.href.toString())
// I think because it encodes more chars than encodeURI and things like passing that complex URL to a twitter client may need this type of thing. Info at:
// http://www.w3schools.com/jsref/jsref_encodeuricomponent.asp
// * A long piece by piece almost complete (less port) reconstruction of a URI is:
location.protocol+'//'+location.host+location.pathname+location.search+location.hash;
// * simple reveal
javascript:alert('reconstructed%20URI%20'+location.protocol+'//'+location.host+location.pathname+location.search+location.hash);
// * -- excessive URI stuff, handles port if any, don't need the other conditionals
location.protocol+'//'+location.host+(location.port?':'+location.port:'')+location.pathname+(location.search?location.search:'')+(location.hash?location.hash:'');
// * CHEAP QUICK EASY way to strip the protocol is
javascript:window.location='wiki://'+window.location.toString().replace('http://','')
// - the above fails on https which is maybe better than kicking user to unencrypted, which the following probably does
javascript:window.location='wiki://'+window.location.toString().replace(location.protocol+'//','');
// -- test your stuff with an alert --
javascript:alert('wiki://'+window.location.toString().replace(window.location.protocol+'//',''));
// - each sub element of a URI revealed VER-1 (SAFARI will escape THE SPACES AND BRACKETS for you)
javascript:alert('[protocol] '+location.protocol+' [host] '+location.host+' [port] '+location.port+' [pathname] '+location.pathname+' [search] '+location.search+' [hash] '+location.hash);
// - SAFARI does the escaping for you when you set it, now
javascript:alert('%5Bprotocol%5D%20'+location.protocol+'%20%5Bhost%5D%20'+location.host+'%20%5Bport%5D%20'+location.port+'%20%5Bpathname%5D%20'+location.pathname+'%20%5Bsearch%5D%20'+location.search+'%20%5Bhash%5D%20'+location.hash);
// - less brackets
javascript:alert('protocol%20'+location.protocol+'%20%5Bhost%20'+location.host+'%20%5Bport%20'+location.port+'%20%5Bpathname%20'+location.pathname+'%20%5Bsearch%20'+location.search+'%20%5Bhash%20'+location.hash);
// - each sub element of a URI revealed VER-2 (excessive)
javascript:alert('protocol '+location.protocol+' host '+location.host+' port '+(location.port?location.port:'n/a')+' pathname '+location.pathname+' search '+(location.search?location.search:'n/a')+' hash '+(location.hash?location.hash:'n/a'));
/* iOS Browser Bookmarklets Apple Dev locations */
//OLD INFO
/* GET A USABLE APPLE DEV LINK: (OLD INFO) OLD INFO */
// - Usable Link:
http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmRules.html
// - iPad turns into an unusable link, bookmarks won't goto it
https://developer.apple.com/library/mac/ipad/#documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmRules.html
/* concept, (http vs https no difference). iPad URL vars reveal this:
.PROTOCOL https:
.HOSTNAME developer.apple.com
.HASH #documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmRules.html
*/
// * reconstruct good URL
location.protocol+'//'+location.host+'/'+location.hash.substring(1);
// * SEND Apple Dev Docs to INSTAPAPER (WORKS): (maybe)
javascript:window.location='ihttp://'+location.host+'/'+location.hash.substring(1);
// Foundation Framework Reference: example (old info)
// * BAD URL
https://developer.apple.com/library/ios/ipad/#documentation/Cocoa/Reference/Foundation/ObjC_classic/_index.html
// - good link
https://developer.apple.com/documentation/Cocoa/Reference/Foundation/ObjC_classic/_index.html
@iruyanka
Copy link

how to "opne in firefox"? can you add firefox bookmark?

@Angles
Copy link
Author

Angles commented Apr 11, 2016

Open in Firefox
javascript:window.location.href='firefox://open-url?url='+encodeURIComponent(window.location.href);

@jlerner
Copy link

jlerner commented Dec 24, 2017

Open tweet in Tweetbot

javascript:window.location='tweetbot://'+location.pathname.substring(1);

@gary87zx
Copy link

How to open in Maxthon 5?

@notapinkgiraffe
Copy link

The Firefox one still works in 2022! Well, on Firefox running on iOS 12.5 anyway. But thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment