Almost all apps on the iPhone can easily open a URL in Safari. But normally you can’t open a URL from within Safari in other apps, for example in iCab Mobile (V 1.7).
But with a “bookmarklet” (a special bookmark which is based on JavaScript code) you can do this as well. Here’s how the bookmark URL for the bookmarklet should look like:
javascript:location.href='web'+location.href.substring(4);
Because you can’t create Bookmarks from scratch in Safari on the iPhone, you should just create a bookmark of a random page and change its URL to the above line and the title to “Open in iCab Mobile”.
If you open this bookmarklet from within the Safari bookmarks, the currently displayed web page is passed to iCab Mobile and opened there.
The bookmarklet simply changes the URL scheme from “http” to “web” and from “https” to “webs”. And because iCab Mobile supports the “web” and “webs” schemes as a replacement for “http” and “https”, the iPhone OS will pass these modified URLs to iCab Mobile.
Wonder if some other developers would be amenable to putting an “Open in iCab” link in their apps. I’m really thinking particularly of Twitter apps – Tweetie in particular.
Yes, I hope as well that other developers will do this. I’ve already written the “AppLink” class which other developers can use in their Apps (see the new blog post from today). This new AppLink class makes it very easy to call alternate browsers like iCab Mobile.
So, ot clarify, iCab reserves the scheme “web”? I assume other web browsers should do the same, and so if the user has only one alternative web browser on his iPhone, links to “web:” will open that one. However, if the user has more alternative browsers, either one may “win”. For that reason, I wonder if iCab _also_ does reserver a unique scheme, such as “icab:” (and “icabs:”) so that one can still identifiy iCan in particular if one needs to?
@Thomas
The “web” scheme is used in my “AppLink” proposal and while it is currently used only in iCab Mobile, it should be used by all browsers which are implementing AppLink. So this “web” scheme might not necessarily address only iCab Mobile. But it is unlikely that someone uses multiple (AppLink-aware) browsers on his iPhone permanently at the same time, so in general this shouldn’t be a problem.
iCab Mobile also supports a scheme “icabmobile”, but which is not directly accepting an URL resources specifier as “web” is doing this. The “icabmobile” scheme is currently used by my App “NewsTap” (a Usenet Reader) to open URLs in iCab and to store bookmarks from NewsTap directly in iCab Mobile. Basically the “icabmobile” scheme accepts a general property list, so you can pass any data to iCab Mobile (like Bookmarks which do have a URL and a title and maybe some other additional properties).
But I will extend this scheme so it will also accept a plain URL resource specifier, so with the next release of iCab Mobile you would be able to address iCab Mobile with the following modified scriptlet as well:
javascript:location.href=’icabmobile’+location.href.substring(4);
Hi Alexander,
the first bookmarklet works fine for me. (The second version not yet.)
But I have a wish: I use 1Password on my iPhone for all my passwords etc.
There is a bookmarklet bookmarklet from agilewebsolutions which works together with safari but not with iCab. Can you tell me if I can change the bookmarklet so that it will work with icab too? Or do I have to ask agilewebsolutions to implement that?n
Beste Grüße, Gernot.
@Gernot Schiefer
Where do I find this bookmarklet for 1Password?
I assume this bookmarklet should also work with iCab if all Safari-specific references are exchanged by general references. But I don’t know this bookmarklet, so I don’t know what it is doing.
Hi Alexander,
as far as I understand the bookmarklet of “1Password touch Pro” is:
javascript:window.location=’onepassword://’+window.location
But please check it on the web page http://agilewebsolutions.com/
If you go to http://help.agile.ws/1Password_touch/pro_edition.html
and then click on the video then it will explain the logic of this bookmarklet.
It works fine with Safari and I would be delighted if you can manage to let it work with iCab.
Beste Grüße, Gernot.
@Gernot
The next release of iCab Mobile will also support custom URL schemes of other Apps like 1Password (this should work already, but because of a bug it didn’t). So the 1Password bookmarklet would also work in the next release of iCab Mobile. But I think this doesn’t help yet, because the 1Password app itself would only call Safari and never iCab at the moment. So there’s still some work to do in 1Password in order to use 1Password together with iCab Mobile. But this would not be very hard at all.
Hi Alexander,
yes, the 1Password bookmarklet works with the new version of iCab Mobile – but 1Password only opens Safari.
I will send them an email and ask if they can implement iCab also.
Best wishes, Gernot.