Modules for iCab Mobile (Updated 2011/03/26)

Update 2011/03/26
Please also read the blog post “iCab Mobile Modules and Apple” for recent events, affecting the modules feature.

The version 2.1 of iCab Mobile introduces a new “modules” feature. Modules make it possible to add new features in iCab Mobile just by downloading them. They can be used for simple things like increasing the font size so a page is more easy to read on the small iPhone screen, but also more complex tasks can be done, like downloading YouTube videos or to post a web page URL at Twitter (including the login and creating a tiny URL). iCab Mobile 2.1 comes with a few built-in modules, and there are also several modules available for download.

This blog post will explain, how you can write your own modules for iCab Mobile and how you (and maybe other users) can install them in iCab Mobile.

Technical background

Technically, modules are somehow similar to bookmarklets, but with more features and more flexibility. This means the modules are written in JavaScript code and they can do everything that can be done with JavaScript. Unlike bookmarklets, where the complete JavaScript code must be squeezed in one single line so that it can be used as a URL with “javascript” scheme, the modules can be nicely formatted, without any line limitation. Modules have a special header section where the module properties are defined. The properties include an icon that is displayed in the Modules panel of iCab Mobile, but also settings which do allow the user to configure the module in the iCab Mobile module settings panel.

The module structure

The module is a normal text file with JavaScript code. There’s a header section and the code section. Here’s an example, how this looks like:

//title=Crazy Layout
//description=The module sets random colors for the page elements
// Modul setzt alle Farben der Seite auf Zufallswerte

var hex = "0123456789abcdef";

function iCabMobileGoCrazyForElement(element) {
  if (element.nodeType == 1) {
    if ( != "none" &&
           element.nodeName.toLowerCase() != 'select') { = "#" +
                   hex.charAt(Math.random()*16) +
                   hex.charAt(Math.random()*16) +
                   hex.charAt(Math.random()*16); = "#" +
                  hex.charAt(Math.random()*16) +
                  hex.charAt(Math.random()*16) +
      for (var i=0; i<element.childNodes.length; i++) {

var doAction = (confirmation == false);

if (confirmation) {
  var text = "Go crazy?";
  doAction = confirm(text);

if (doAction) {

The header section defines the properties of the module. The header section starts with the line


and ends with the line


Between these two lines all the properties are defined, each individual property definition occupies exactly one line, so currently you can’t split the definition of a property into multiple lines. Also no empty lines are allowed in the header section. Each property definition has the following format:

//property=value;additional paramaters

The additional parameters are optional and not always needed or required.

There are some properties which are required. If they are missing, iCab Mobile will ignore the module. Other properties are optional and do not need to be present. Here are the properties which are currently supported:

id (required)
This property identifies the module. When updating or reinstalling a module, the value of the “id” will be used to find the old module that has to be replaced by the new one. So when updating a module, you must not change the value of the “id”. Everything else can be modified, even the name of the module. The value of the “id” property should be unique among all existing modules. The best way to find a good “id” value is to use a reverse domain name appended with the module name. If your own web page has the domain “” you should set the “id” value to “com.your-domain.moduleName”. All of your own modules will have the same reverse domain prefix and the module name as suffix. If you don’t have your own domain, you can use your name and city as a prefix and maybe some random numbers, anything which makes it unlikely that someone else uses the same id value. The “id” is not visible to the user within iCab Mobile. Its only used to identify the module.


or if you don’t have your own domain, you may use something like this:

title (required)
The title defines the name of the module and is displayed within the modules settings of iCab mobile. The title property is needed so that the user can enable or disable the modules in the in-app settings and also configure the modules settings.

//title=Crazy Colors

You can also define localized versions of the title. Just append the language code (for example “en” for English, “de” for German, “it” for Italian etc.) of any of the languages which are supported by the iPhone OS to the “title” keyword
like this:

//ückte Farben

This way you can easily localize the module in many languages. The key “title” without a language code appended will be used as default language which is used when none of the defined languages does match the current language of the iPhone or iPod Touch. In general the default language should be English. If no default language is defined, then the very first language that is define will be used as default language. But it is highly recommended, that you simply use English as the default language (without language code).

So if the module supports English and German, the title would be defined this way:

//title=Crazy Colors
//ückte Farben
description (optional)
The description is displayed in the settings panel of the module in iCab Mobile. The description should explain what the module is doing. Localizing is done in the same way as described above for the title. Append the language code to the “description” keyword: 

//description=The module sets random colors for the page elements
// Modul setzt alle Farben der Seite auf Zufallswerte
icon (optional, but highly recommended)
The icon is displayed when the user opens the modules panel where the modules can be activated by tapping on their icon. The icon should be an image file in PNG or JPG format. The data of the image file must be encoded with “base64” and this “base64” encoded data can be then used as value for the “icon” property. Usually the base64 data is formatted in lines of at most 64 characters length, but for the modules, all line breaks must be removed, so the icons data can be completely included in one line. The size of the module icons (the visible part) should be approx. 41*32. You can use the following empty icon image as a template for your own icons:

The “var” property defines JavaScript variables, which are initialized by iCab Mobile. These variables can be used to allow the user to configure the modules, but also to get certain system properties, like the system language. 

Variables do have the following format:


iCab Mobile will create a standard JavaScript variable declaration and initialization for all of these variable properties and adds these to the JavaScript code of the module. So your JavaScript code of the module can check and use these variables just like any other variables.

The value of the “var” property is the name of the variable.

The “title” property is required, when the variable should be presented to the user in the module settings, so the user can change the value of the variable. The value of the “title” property is used as the label in the settings panel. You can add additional localized versions of the title, just by appending the language code (as described above).

The “default” property can be used to define a certain default value for the variable.

The value of the “type” property is the type of the variable, which can be one of the following:

bool or boolean
The variable can have the values true or false. In the module settings this variable will be represented by a “switch” control. If the user switches it on, the variable will have the value true otherwise the variable will have the value false. The title attribute is required for this type. The title is shown as label for the switch in the module settings.
int or integer
The variable can have a numerical value. In the module settings, this variable is represented with a text field where you can enter digits. The title attribute is required for this type. The title is shown as label for the edit field in the module settings.
string or text
The variable can have a string value. In the module settings, it is represented as a text field. The title attribute is required for this type. The title is shown as label for the edit field in the module settings.
pass or password
The variable can have a string value. In the module settings, it is represented as a text field where the input is hidden. The title attribute is required for this type. The title is shown as label for the edit field in the module settings.
lang or language
The value of this variable is a string that contains the language code of the currently selected system language. This variable is not presented in the settings panel of the module. Therefore no title property is required here.
confirm or confirmation
The variable has a boolean value. It is represented in the module settings by a switch where the user can enable or disable a confirmation box. If enabled, iCab Mobile will ask each time the module is activated, if it should be really executed. This variable does not need a “title” property because it is automatically localized within the module settings panel.
The variable has a boolean value. It is represented in the module settings by a switch where the user can configure, if the module should be automatically run when the page has finished loading. This variable does not need a “title” property because it is automatically localized within the module settings panel. If there’s no variable of the type “autorun” set, the module can only be opened manually. You can set the default value for the variable to switch on or off the “autorun” feature for the module. But the user will be always able to disable the “autorun” feature in the module settings. When the modul is executed, the variable that is defined with the type “autorun” will have the value “true” if the module was executed automatically (which means when the page has finished loading) and the value “false” if the module was opened manually by the user. So a module is able to do different thing when called automatically and when called manually (for example it can mark elements when called automatically to notify the user about something, and modify the elements when called manually, to do the real work). [This feature will be available in iCab Mobile 3.3, it’s not yet available in version 3.2]
The variable of this type can be used to select one item from an array of items. This variable type uses the title property in the same way as the other types to define the label in the module settings. This variable type requires that two other properties are defined as well. The “values” property must be defined to create the array of values the user can choose from, and the “valuetitles” property must be defined to define the array of titles for these values. The “valuetitles” properties is localizable again, so append the language code as shown above for the “title” property. For the “values” and “valuetitles” property, all items must be separated by the “|” character.
An example: 


In the settings the user would be able to choose between “One”, “Two” and “Three”. If the user selects “One” the variable s would have the value 1, if the user selects “Two” the variable s would have the value 2 etc. The default value would be 2 and the user would see that “Two” is preselected. The whole setting would have the label “Number”.

When the user activates a module, iCab Mobile will process the header sections and creates JavaScript variable declarations for all the variable definitions from the header section. The values for these variables will be determined by the module settings. Technically, iCab will add these variable declarations before the JavaScript code section of the module, so the module can access these variables. These variables and the JavaScript code section will be embedded in a block, so they have their own scope and do not interfere with the JavaScript code and variables which are already present in the web page.

This means, when the module looks like this:

//title=Some Module

function DoSomething() {
  // here's the actual code which is doing all the work of the module

if (confirmation) {
  doAction = confirm("Really activate the module?");
} else {
  doAction = true;

if (doAction) {

the resulting code that is actually executed in the context of the web page looks like this:

  var confirmation = true;
  var language = "en";
  var text = "User Input";

  function DoSomething() {
    // here's the actual code which is doing all the work

  if (confirmation) {
    doAction = confirm("Really activate the module?");
  } else {
    doAction = true;

  if (doAction) {

Special JavaScript functions

Modules can also call special JavaScript functions, which are defined by iCab Mobile to do certain tasks.

There are the following functions available:

This function starts a download. The parameters are the URL and a suggestion
for the filename under which the download should be saved.
This function gets the data from the URL using the HTTP POST command (posting “content” to the server) and then passes the HTTP status code and the data to a function called “callBackFunction” (see getRequest() below for a description of the callback function).
This function gets the data from the URL using the HTTP GET command and then passes the HTTP status code and the data to a function called “callBackFunction” (the second parameter is a string with the name of the callback function that must be implemented by the Module to process the data): 

function callBackFunction(status, data) {
  // "status" is an integer value with the HTTP status code (200, 404, etc)
  // "data" is a string with the URL data

Installing the modules

Installing the modules is done by simply downloading them from a web site. So all you need to do is to provide a web page which contains a link to your module. The link URL must use the URL scheme “icabmodule” or “javascriptmodule” instead of the usual “http” scheme. This is how iCab Mobile detects that it should download and install a module.

For example, if your module can be accessed with the URL
the HTML link you would have to include in your web page would look like this:

<a href="icabmodule://">Download TheModule</a>

or alternatively look like this:

<a href="javascriptmodule://">Download TheModule</a>

If you include these links on a web page which is accessible to other people as well, other iCab Mobile users would be also able to install your module. So you can easily share your modules with other users.

I’ve created two URL schemes for the modules. In case other iPhone developers are interested in this module feature (candidates would be developers of other iPhone browsers), it would be great if all these modules would be compatible. In this case the general URL scheme “javascriptmodule” could be used by all the Apps supporting the modules feature. And the other URL scheme could be used for application specific-modules (so “icabmodule” would be only accepted by iCab Mobile).
Just a reminder: My AppLink Proposal can be also used by other iPhone Apps.

You can also sent the module to me so I can include it into the modules download page, which is accessible through the “Download” module that is built-in in iCab Mobile. This way the module can be immediately found by all iCab Mobile users.

104 thoughts on “Modules for iCab Mobile (Updated 2011/03/26)

  1. thank you,

    will you bring a grab & drag scroll on the bookmark bar in the future?

  2. Is anyone else having problems with the readitlater plugin? It claims that it’s saving it, but it never shows up…

  3. Where is the page where I can DL already available modules?

    Why is there no clear link to it? Very frustrating.

  4. @KimH
    These modules are useless without iCab Mobile, so these modules are accessible directly from within iCab Mobile. Just open the “Modules Download” module (which is a built-in module in iCab Mobile which is enabled by default) and you’ll get the list of all available modules. And from there you only need to tap on the module you want to install.

  5. Quick suggestion for the Video Download module on YouTube, if “fmt=18” is changed to “fmt=22” you can download the 720p versions of videos (if available). It’d be nice if it asked if you would like to download the SD or HD version when using the module.

    (For now I just duplicated it and changed it for my own use, renaming it to Video Download HD so I can pick which format to download)

  6. Addendum to my last post, it downloads HD on the iPad. I just tried it on my iPhone 3G and it gave me an SD video instead. I have no clue if it’d serve up HD or SD on the iPhone 4.

  7. These are some great modules – thanks for all the hard work.

    Not sure if it’s possible, but has anyone thought about creating a 1Password module? I’d really like to be able to submit my username/password without having to jump out of iCab to go into the 1Password app, then to have to go back into iCab.

    That’s really the only thing I think iCab is missing, for my workflow.

  8. @Jerome
    The Mac Version of 1Password can export a bookmarklet to the Safari bookmarks, and this bookmarklet does also work in iCab Mobile. But AFAIK all the passwords are included within this bookmarklet, so if you add or change passwords, the bookmarklet has to be renewed.

    Directly passing passwords from 1Password on the device to iCab Mobile to fill out a login form for example would require that the 1Password app can pass the password data to iCab Mobile. And it seems that the 1Password developers are currently not very interested in implementing this.

  9. I think icab is easily the best browser, but would also love syncing bookmarks, it’s really the only thing obvious missing. I agree with the suggestion above about syncing with google bookmarks, (would make it similar to firefox’s GMARKS extension)

  10. I also share the previous opinions. It is really one of the best browsers I tried for iPad.
    For me, to make it perfect the following are missing:
    – Save document (if the content being shown is a document)
    – More gestures (ex.: 3fingers maximize / restore)
    – Save page / email page – a way of sending the page and not the link to it
    – Export / import bookmarks to / from file
    – Bookmark sync with Xmarks
    – Auto search Google as you type (selection of search engine could be a different button)

    Congrats for the great work so far.

  11. @PO
    Saving documents will be possible in the next release. Also search suggestions from google and yahoo are supported in the next release.

    XMarks doesn’t have an API yet, so there’s currently no way to add support for XMarks. All the available tools for XMarks for other browsers are coming from the XMarks people themselves. So if they don’t write a tool for the iPhone that would work with iCab Mobile, there probably won’t be a chance to get XMarks support at the moment.

    What exactly do you need for exporting/importing bookmarks. iCab Mobile can export/import bookmarks via WLAN already. And the next release of iCab will also support DropBox to export/import its bookmarks file.

    What gestures do you need exactly?

  12. @Alexander
    Thank you for you answer.

    Concerning the bookmarks dropbox support support will be good. Looking forward for the Xmarks team to make the API available.

    Regarding the gestures I would say something you can find in my 2nd best iPad browser.

    What about Save page / email full page?

    Thanks again

  13. @PO
    Saving the page is supported in the next release. The saved page is stored in the Downloads Manager, so you can do everything you can do with normal Downloads, which includes sending the file via email. Though saving web pages is done as “Web Archives” (which includes images and other resources), which might not be always the right file format in all circumstances.

  14. Although I bought icab quite a while ago I’m just now trying it out and am very impressed. But I’m confused byt the download module. When I click on it there is nothing but an empty box. Clicking on the buttons does nothing. Also I don’t understand how to sync with my Macs Safari bookmarks.



  15. @Kit
    The “Download-Manager” is empty unless you download some files. And to download a file, you only need to click on the download links on a web page which provides downloads, or tap-and-hold on a link and select “download” in the contextual menu to force the download of the linked file. With the buttons in the downloads manager, you can delete the downloads, remove the failed download items etc.

    And to sync the bookmarks from Safari on the Mac, you have to export the bookmarks from Safari first to save them in a file on your Mac. Then user the export/import feature of iCab Mobile to upload the bookmarks. Just follow the instructions within iCab Mobile in the export/import panel.

  16. Sorry if I wasn’t clear. I was referring to the modules for cab mobile. I can’t seem to find any to add and thought they were available in the download window.

    Thanks for the sync info.



  17. @Kim
    There are many additional modules available. You only have to use the “Modules Download” module (which is one of the default modules). This module opens a page where you can find many additional modules. Installation is easy: just tap on the module link, and it will be downloaded and installed automatically.

  18. hello!
    can i execute some system command with my JS code in module? i need to make module, that can upload downloaded file to my server with scp (scp is included in iOS)
    please, answer to mail

  19. @norlin
    No, you can’t execute anything that is not covered by the JavaScript engine. For a few tasks iCab provides some special functions, which can be used by the modules, for example a function to download a file or to do POST or GET HTTP requests. But currently there’s no upload function available.

  20. Please teach me: What version of javascript is supported by the Javascript Engine of iCab Mobile 4.0 ?

    I am writing a Module for iCab Mobile. I want to write as following:
    1: var str = “^http://.*$”
    2: var rex = new Regexp(str, ‘i’);
    But this don’t seems to be executed correctly as I want (stop execution on line 2 ?).

    Regexp object is supported, or not ?

    Sorry for my broken English. It’s not my native tongue.

  21. @forzando
    iCab uses the standard WebKit engine that is also used by Safari (Apple doesn’t allow anything else on the iPhone/iPad). And WebKit supports “RegExp”. So you should check your code again, in your comment, you’ve written “Regexp” instead of “RegExp”, so maybe this is the problem?

  22. @Alexander
    I have modified ‘Regexp’ to ‘RegExp’ and all are going correctly.
    Why don’t I notice it…orz

    Thank you for your kindness.
    Thank you for wonderful browser !

  23. Is it possible to create a Module that can switch the image loading mode (Full/No image)? This would be useful for 3G/GPRS users who wants to get a fast loading or save their network.

  24. Anybody aware of a module which gives me the full URL of an image on the website? Currently I can download it and also see the link in the popup box header, but I need a feature to copy it into the clipboard. Thanks!

  25. @Christian
    Currently you can’t call a module from within the contextual menu (tap-and-hold on an image). This means you can’t get the URL of an image this way. But of course it would be possible to write a module which would scan a web page for images and add their URLs as text or links to the web page (maybe at the end of the page), so you can select and copy these URLs very easy.

  26. @fnurl
    Just use the “Download Modules” module to get the list of modules you can download. Among thee modules, you’ll find the “Read It later” module.

  27. How about a mouse rollover module/gesture for displaying alt images and other things that happen when you hover over links and things like on a desktop? Such as drop down menus..

  28. @Quinnthouzand
    “Hover” events do not work on touch-based devices. The device can only detect touches (“click”, “mousedown” or “Mouseup” events).

  29. I’m trying to create a font-changing module by editing @font-face property of the webpage.

    First, I tried base64 encoding to embed a fontfile in the module.
    It works well while the volume of a fontfile is not so large(~1MB),
    but when I embedded a font that the volume is large(ex. Chinese/Japanese fonts),
    the module doesn’t work well because it causes crashing iCab.

    So I want to access the downloaded manager from the module and use a fontfile in there,
    but I haven’t got any idea to access there from the module….That’s why I questioned before.

    Have you got any alternative idea to realise this function?

  30. @keage
    Yes, the size can be a big issue because most of the iOS devices do not have much main memory. So when dealing with fonts that are several megabytes large, the device can easily run out of free memory, especially when the fonts are even larger because of the base64 encoding and additional memory is required to decode them.

    You may try to load the fonts from the internet. Put the font on a web server and use a direct link to the font within the module to load it from the web. This way the iOS would be able to use it’s default caching mechanisms which probably work better with low memory conditions. But of course this has also some issues, like the user has to wait for the font to be downloaded. But I think that there’s not much you can do otherwise.

  31. I purchased iCab mobile for my ipad v4.2.1, thinking it had a video download module, but I cannot find one under the download module tab. Can you help?

  32. Hi,

    for postRequest, how do i set content type? I need to set it to json for my plugin to work.


  33. I cannot find “Module Downloads” module nowhere in iCab 4.8.4. Why you just simply wont publis some URL (with all modules) to be available for everyone. Why is such a simple task so complicated???!!!

  34. @Dusan Hlavaty
    Just follow the link “iCab Mobile Modules and Apple” at the top of the blog post and you can read why the “Module Downloads” module was removed. I could only remove this module and the ability in iCab Mobile to download and install modules from the internet, or Apple would have removed the App from the AppStore. It doesn’t help that we all know that Apple’s decision doesn’t make any sense, but Apple makes the rules. So as a developer you can either follow the rules or you’re out.

    All I could do was to include the modules in iCab Mobile, which I’ve done (as far I’ve got the permission to do so and there were no legal reasons not to include certain modules).

  35. hi there, im going to use some ipads for a event where people JUST can surf the web with it (they are attached in a frame so the users can not press the homebutton, steal etc). the idea behind it is to let the guest surf the events website but also allow to use other websites. the thing is… after a guest uses it and a other guest gets to the ipad, he will see the last page. i would like that the new guest gets started with the events website.

    is it possible to make a funktion that says… after 5min of idle iCab, restart the url given in the setting (startsite)

    sorry for my bad english

  36. @davidS
    Check out the “Kiosk Mode” setting in the iCab Mobile settings within the “Settings” App from the home screen. Here you’ll find this feature already as part of the Kiosk mode. The Kiosk mode is a special “protected” mode for usecases like yours. In Kiosk mode there’re no in-App settings, no download manager, no bookmarks, no URL field etc. Just the web page is accessible, so users can only do what you wants them to do (which is what the web page allows the users to do). The Kiosk setting includes a white list so you can limit the web sites the suers are allowed to visit. And it also has an idle timer. You set it to a certain time (like 5 minutes) and when the device was not touched for 5 minutes, it will
    automatically load the kiosk start page you’ve defined.

Leave a Reply

Your email address will not be published. Required fields are marked *