sIFR Documentation and FAQ
Javascript Implementation

There are some specific issues you need to take care of if you want to implement sIFR. Unsurprisingly, the issues you find here have to do with JavaScript.

Make sure sIFR is a function

If the browser does not support the necessary Flash version, or if the browser itself isn't adequate for sIFR, the sIFR variable will be an object. In this case only the UA object is exposed, and not the replaceElement method. You can test if sIFR is a function like this:

if(typeof sIFR == "function"){
    // do stuff
}

Using the UA object

The sIFR.UA object contains the results of the browser detection done by sIFR. This object is read-only.

The following properties can be used:

The meaning of these properties should be self-explanatory.

Global variables

When sIFR is active on a page the following variables will exist in global scope: hasFlash, named, parseSelector and sIFR. Other functions must not overwrite these variables, or else the code will break.

Additionaly, sIFR creates String.prototype.normalize() and in the case if IE 5.0 on Windows Array.prototype.push() and Function.prototype.apply().

Event Hijacking

For IE/Mac and Konqueror sIFR registers its initalizing method using window.onload. If other scripts overwrite or hijack this event, sIFR will not initialize. Depending on the situation this could lead to empty spaces where the sIFR elements should be. You can prevent this from happening by making sure all scripts which set window.onload have been loaded before sifr.js is loaded.

Changing the document title

Due to the Fragment Identifier Bug sIFR makes sure the title of the document does not change after replacements (in IE). This means that if you are using a script which does change the title, you need to change the title in sIFR as well. To do this, first change the title, and then call sIFR.updateDocumentTitle().