Animations
function SniffBrowser() {
/***************************************************************************
This function is a browser sniffer that returns a string-indexed array.
The call:
$browser = SniffBrowser();
will return the following:
$browser['type'] = Netscape, Explorer, Opera, Amaya, Unknown
$browser['version'] = version number (float)
$browser['platform'] = Windows, Mac, Other
$browser['css'] = CSS version
$browser['dom'] = DOM type: NS, IE, W3C, 0
***************************************************************************/
global $HTTP_USER_AGENT;
$b = $HTTP_USER_AGENT; $vers = 0.0;
// detect browser brand and version number
if (eregi('Opera[ \/]([0-9\.]+)' , $b, $a)) {
$type = 'Opera';}
elseif (eregi('Netscape[[:alnum:]]*[ \/]([0-9\.]+)', $b, $a)) {
$type = 'Netscape';}
elseif (eregi('MSIE[ \/]([0-9\.]+)', $b, $a)) {
$type = 'Explorer';}
elseif (eregi('Mozilla[ \/]([0-9\.]+)' , $b, $a)) {
if (eregi('compatible' , $b)) {
$type = 'Unknown';}
else {
$type = 'Netscape';}}
elseif (eregi('([[:alnum:]]+)[ \/v]*([0-9\.]+)' , $b, $a)) {
$type = $a[1]; $vers = $a[2];}
else {
$type = 'Unknown';}
if (!$vers) $vers = $a[1];
$browser['type'] = $type;
$browser['version'] = $vers;
// detect platform
if (eregi('Win',$b)) $browser['platform'] = 'Windows';
elseif (eregi('Mac',$b)) $browser['platform'] = 'Mac';
else $browser['platform'] = 'Other';
// find CSS version
// note: it is unknown which future versions will support CSS2
if ($type == 'Netscape' && $vers >= 4 ||
$type == 'Explorer' && $vers >= 3 ||
$type == 'Opera' && $vers >= 3) {
$browser['css'] = 1;
if ($type == 'Netscape' && $vers >= 5 ||
$type == 'Explorer' && $vers >= 6 ||
$type == 'Opera' && $vers >= 4) {
$browser['css'] = 2;}}
// detect DOM version
$browser['dom'] = '0';
if ($type == 'Explorer' && $vers >= 4 && $browser['platform'] == 'Windows') {
// note: it is unknown which DOM model future versions of Explorer will use
$browser['dom'] = 'IE';}
elseif ($type == 'Opera' && $vers >= 5) {
$browser['dom'] = 'W3C';}
elseif ($type == 'Netscape') {
if ($vers >= 5) $browser['dom'] = 'W3C';
elseif ($vers >= 4) $browser['dom'] = 'NS';}
// return array of answers
return $browser;}
$browser = SniffBrowser();
?>
if ($browser['dom'] == 'IE') { ?>
} elseif ($browser['dom'] == 'NS') { ?>
} elseif ($browser['dom'] == 'W3C') { ?>
} else { ?>
} ?>
Animations can be useful to make your web pages fun and to attract attention to
something important. However, animations are all too often used in places where
they are only annoying and
distract the viewers' attention away from the important parts of the page. You
should therefore think twice before you decide to use animations on your pages.
There are several methods for making animations:
Animated GIF's
This is the most common method. The .gif format for images allows the image to
change. You need special software for making animated gifs. Shareware or trial
versions of such software can be downloaded from the Internet.
Flashing text
Old method: <BLINK></BLINK>. This
method works only in Netscape.
Style method: <SPAN STYLE="text-decoration:blink">This text will flash</SPAN>.
This method works in most newer browsers.
Marquees
<MARQUEE width="50%"></MARQUEE>. This
method works only in MS Explorer.
Java script
The combination of Java Script and Document Object Model (DOM), also called
Dynamic HTML, is the best way to make text and images appear,
disappear, and move anywhere in the browser window. Unfortunately, DOM is not
yet fully standardized, and therefore has to be coded differently for different
browsers. You need a browser-sniffer to
detect which browser the user has, and supply the code that fits the users'
browser. Description.
The aeroplane you see here is made with this method. View
source code.
Java applets
Java applets can make quite impressive animations within a square area of the
screen. Java applets may take considerable time to download and start. Description.
Macromedia Flash
This is a technology for making impressive animation effects without the need
for a high bandwidth. Description.
Video
It is possible to supply video files, for example in the .avi format, that
can be seen in a square area of the screen. Video files take very long
time to download, especially if the user has a slow connection.