# Other Features

## Save web pages

When saving a web page you can choose between several different file formats.

Web Archive (ZIP)
  This file format saves the complete web page including images and other external files like JavaScript and Style Sheet files in a single file (a standard ZIP archive). This file can be directly opened in iCab to display the web page again. But you can also access the files in these archives from within ZIP applications, though there can be some limitations in some of these ZIP applications.

  The ZIP Web Archive file format can be used to save not only a single web page but also to save a whole web site or any number of web pages in a single archive file. You can do this using the Download Manager or by recording a Session.

Web Archive (Safari)
  This file format is used by Safari to save a whole web page including images and other external files in a single file. This is similar to the ZIP Web Archive format from above with the limitation that a Safari Web Archive file can only store a single web page. iCab 4 can read and write Safari Web Archive files, so you can use this file format if you want to open the file in Safari as well.
HTML Code
  Using this format iCab saves only the HTML code of the web page, nothing more. So images and other external files won't be saved.
Text
  This format saves only the text content of the web page as plain text file. All images and other external files won't be saved. Also the text formatting and styles will be lost. This format is useful if you want to use the text content of a web page in a word processor, for example.
PDF
  This saves the web page as PDF file. All images and the text formatting will be saved as well.

## Snap-Back

iCab supports the keyboard shortcuts for the "Snap-Back" feature of Safari

- Cmd-Alt-P: goes back in the history until it finds the start page of the current web site
- Cmd-Alt-S: goes back to the last results of a search engine request (which are initiated via search field for example).

## Cursor Variants

If you move the mouse cursor within a web page, you'll notice that it can have many different shapes. According to the shapes you can get some useful additional information about the context.

Pointing Hand where the thumb points to the top right
  The mouse is moved over a link, and a mouse click will open the linked web page. The linked web page is not stored in the Web Cache, so iCab has to load the page from the internet.
Pointing Hand where the thumb points to the top
  The mouse is moved over a link, and a mouse click will open the linked web page. The linked web page is stored in the Web Cache, so iCab can load this page without an internet connection when iCab is in Offline node.
Pointing Hand with attached pile of documents
  Clicking the link will open a new window or Tab. (Because you know in advance that the link will open in a new window or tab, and if you don't want this to happen, you can even decide to open the link in "this window" using the contextual menu item Link > Open Link in this Tab/Window)
Pointing Hand with exclamation mark
  The link provides some additional information which will open as tooltip.
Arrow with attached Document
  Through the contextual menu you can get a detailed description of the clicked image or the source of a citation.

## Text encoding

Web pages can be encoded in many different text encodings (UTF-8, ISO-8859-1, etc). In general iCab is able to determine the correct encoding automatically to display the text correctly. But there are still a few web pages which do not have a proper declaration of their text encoding and the encoding that is used can't be determined automatically. In this case iCab will use the default text encoding that is configured using the menu item View > Text Encoding. So in case you'll notice that on a certain web page some special characters are not displayed correctly, you could try out a different text encoding setting.

## User-defined JavaScript code

In the JavaScript settings of the Preferences dialog you can configure a file with JavaScript code that will be executed on every web site you visit. In the JavaScript settings of the Filter Manager you can do the same in a site-specific way.

Executing the user-defined JavaScript code allows you to include additional features to web pages, or modify the structure or behaviour of the web page. This is a very powerful feature, but you'll need some knowledge about HTML, JavaScript and the Web to be able to create your own user-defined JavaScript code.

In the iCab archive there's an example of this feature: The YouTube video download filter. This filter is a simple file you only need to import in the filter manager of iCab (double-clicking the file in the Finder will do this as well). Then whenever you go to www.youtube.com and open one of the videos, iCab will add a yellow bar at the top of the web page with download links for the video. YouTube doesn't offer download links, but with this filter iCab is able to add this missing feature. The filter will use the user-defined Javascript code feature to do this. So using predefined filters like the YouTube filter even users without knowledge about HTML and JavaScript can benefit from this feature.

User-defined JavaScript code is just ordinary JavaScript code, which will be executed when the web page is loaded. The code is treated as part of the web page, so it has access to the whole content and code of web page.

The user-defined JavaScript code is executed just before the web page code is loaded. So the user-defined JavaScript code can even do things before the web page has a chance to do anything. But this requires MacOSX 10.4.11 or newer. Under older MacOS releases this won't work reliable. So when the user-defined script has to work under older MacOSX releases as well, you can't just define an "onload" handler which will be called when the page has finished loading, because the handler might not be called in all cases (this is a limitation of the older MacOS/WebKit releases). When it is OK that the script runs only with MacOSX 10.4.11 and newer, you can just define a function "initFunction" which is doing the work and install an onload handler which calls this function. You can do this in the following way:

    function initFunction() {
    	// Do all the work here
    }

    window.addEventListener("load",initFunction);

When the page has finished loading, the function "initFunction" is called which will then do all the work your script.

As said above, under older MacOS releases this won't work reliable, the event handlers that are defined are not active anymore after the page was loaded. So iCab offers an alternative way to solve this problem. You can declare your initializing function at the very beginning of the file like this (note that the line has to begin with "//"):

    // @init = initFunction

And then define the initializing function as usual:

    function initFunction() {
    	// Do all the work here
    }

When the page is loaded, iCab will automatically call the "initFunction", just like it would have been done when defined as an "onload" handler. This works in all MacOS releases.

In case you want to add a link to the web page which should start a download even if iCab would normally be able to display the linked file itself, you can add a `TARGET` attribute with a special value to the link tag (the tag `<A>`). iCab interprets this special value and will then start a download instead of just opening the link as usual. This special value is `_icab_open_in_downloadmanager_`. This is an example:

    <a target="_icab_open_in_downloadmanager_" href="download-url">Download</a>

You can even add a parameter to this value to define a certain filename which should be used to save the download on disk. An example:

    <a target="_icab_open_in_downloadmanager_;filename=xyz" href="download-url">Download</a>

This will save the download under the filename "xyz"

## Experimental Settings

iCab provides several other settings which are very special and only useful for a few users. You get this settings by entering "settings:" in the URL field and pressing the Return key.