DHTML Lab - dhtmlab.com - Dynamic Headline Fader, Version 2.01 | 6 | WebReference

DHTML Lab - dhtmlab.com - Dynamic Headline Fader, Version 2.01 | 6

Logo

Dynamic Headline Fader, Version 2.01
accounting for broken filter support in IE


The Problem

An error message, similar to the one below, appears when loading a page that contains the fader:

What the error message is trying to tell us is: this browser does not support filters.

Filter Support

IE4 introduced visual and transition filters. Transition filters, can be either the Blend Transition, or one of the many Reveal Transitions. The Fader script uses the Blend Transition. The Reveal Transitions have been discussed at great length in Column 19.

So, since filters are an integral part of IE, how is it possible that an error message is generated? Possible reasons include:

  1. The browser used is IE for Macintosh.

    Filters are environment-specific. They are supported only on Windows and some Unix platforms. In Windows, filters are available to all IE4+ browsers. On Unix, filters are available to IE5.

  2. The browser used is IE4.x for Windows, running in Compatibility Mode.

    Although not widely publisized, it is possible to install both IE4 and IE5 on the same system. Complete information can be found in this Microsoft Support page:
    How to Install and Use Compatibility Mode in Internet Explorer 5

    When you have both versions of IE installed, only IE5 is a truly complete version. IE4 is dependent on IE5 Internet Option settings, and...it lacks filter support.

  3. The browser used is IE4+ for Windows, but filter support is broken.

    Filter support is determined by an entry in your system's registry. If this registry entry is damaged, filter support will cease. See this Microsoft Support page, for some details and a suggested fix:
    Script Error Viewing a Web Site That Uses Transition Filters

    Whether browser features should be platform-specific and dependent on registry entries is, of course, another issue.

The Solution

Admittedly, IE4+ for Windows does not often lose filter support, but it may.

In Version 2.01, we check for filter support in IE, and apply the Blend Transition only if the browser can render it.

In the FDRinit() function, at the end of the IE-specific statements, we add one line:

function FDRinit(){
   .
   .
   .
   if (NS4) {
      .
      .
      .
   }
   else {
      .
      .
      .
      IEhasFilters = (elFader.filters.blendTrans) ? true : false;
   }
.
.
.
}

If the blendTrans filter is an object, that is, if filters are supported, our new IEhasFilters variable will be true. With no filter support, IEhasFilters will be false.

Using IEhasFilters, we can now conditionally apply and play the Blend Transition in the IE-specific portion of the FDRfade() function:

function FDRfade(){
   .
   .
   .
   if (NS4) {
      .
      .
      .
   }
   else {
      .
      .
      .
      if (IEhasFilters) elFader.filters.blendTrans.Apply();
      elFader.innerHTML = newsStr;
      if (IEhasFilters) elFader.filters.blendTrans.Play();
   }
.
.
.
}

Now IE users with no filter support, will not get an error, and will get rotating headlines, but without any transition effect. At least with Windows. On the Macintosh platform, Explorer has a few more problems we need to solve.


Produced by Peter Belesis and

All Rights Reserved. Legal Notices.
Created: Sep 21, 1999
Revised: Sep 21, 1999

URL: http://www.webreference.com/dhtml/column25/addendum1/fdr201filter.html