Last changes were at
Download example (.zip 8kb)
Note1: After a lot of testing (about 7000 tests summary - i don't think that it is possible make more testing :) in a lot of different browsers and OS, we received following:
This way with JS accelerator - fails in 12.62% of tests
This way without JS accelerator - fails in 7.14% of tests
Just Button way - fails in 3.88% of tests
The best other JS way that can be found in the net - fails in more than 16% of tests
The best other JS-free way that can be found in the net - fails in more then 9% of tests
Note2: Example rewrited for people why don't have Flash4. So there is no need to change detection.fla - just edit urls.txt
With default settings:
PagesName=flash&ext=.html&loaded=1&
it will open flash2or3.html, flash4.html, flash5.html and flash6.html
and for example with:
PagesName=my&ext=.asp&loaded=1&
there will be flash2or3.html, my4.asp, my5.asp and my6.asp
Besides take a look at JustButton.fla - it works stable (you must edit it in Flash4 only too)
There is no any news in this method. Same ways you may find
on
http://www.moock.org/webdesign/flash/
and
http://www.artswebsite.com/coolstuff/flash.htm
but I hope that this one is much more easy and works better :)
If want to detect presence and version of Flash plug-in, try make swf (I call
it detection.swf) with 6 blank keyframes
with action in the first
Set Variable: "ok" = "flash4or5"
Go to and Play(ok)
in second
Get URL ("flash3and2.html")
in third
Stop
give fourth keyframe label "
flash4or5" and no any
actions
in fifth
If (Substring (Eval("$version"), 5, 1) < 5)
Get URL ("flash4.html")
Else
Get URL ("flash5.html")
End If
and last keyframe give action
Stop
Remember that you must edit that .fla file inside Flash4
not 5 !
And you have to edit your .html code after publish (there will be no autoinstall
install of active-x from your page with this code)
<html>
<head>
<title>Detection of presence and version of Flash plug-in</title>
<meta HTTP-EQUIV="Refresh" CONTENT="8;URL=nonflash.html">
</head>
<body>
<p>
<center><h3>Please wait 8 seconds...</h3></center>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
ID=index
WIDTH=2 HEIGHT=2>
<param NAME=movie VALUE="detection.swf">
<param NAME=quality VALUE=high>
<param NAME=bgcolor VALUE=#000000>
<embed src="detection.swf" quality=high bgcolor=#000000 WIDTH="2"
HEIGHT="2"
TYPE="application/x-shockwave-flash">
</embed>
</object>
</body>
</html>
If there is no "Flash redirection" for 5 seconds, page will refresh to hohflash.html.
If you server is slow - change 8 (in "8;URL=nonflash.html")
to 9 or 10.
And don't forget about 2x2 :) (real size of movie
may be any) to prevent non-flash visitors from clicking on empty place without
movie.
There is only two problems with this code:
1. visitors without Flash support have to wait too long
(8 seconds:)
The easiest way to fight against it is to add few JavaScript strings. I don't
talk about JS monsters like "the moock fpi" or MM SDK (actually I
don't understand what for they have so much code ). Lets make easy things easy
:) We don't need to know something about attempts to install plug-ins for browser
and we don't need to know different system information about that plug-ins.
The only thing that we need to know is
works that plug-in
or not. Or in other words is
document.movieID
JS object or not. So lets add "JS accelerator" to our existing
meta
HTTP-EQUIV="Refresh"
Now it will look like
<html>
<head>
<title>Detection Flash4 support</title>
<meta HTTP-EQUIV="Refresh" CONTENT="8;URL=nonflash.html">
</head>
<body>
<p>
<center><h3>Please wait...</h3></center>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
ID="detection" WIDTH="2" HEIGHT="2">
<param NAME=movie VALUE="detection.swf">
<param NAME=quality VALUE=high>
<param NAME=bgcolor VALUE=#000000>
<embed src="detection.swf" quality="high" NAME="detection"
swLiveConnect="true"
bgcolor="#000000" WIDTH="2" HEIGHT="2"
TYPE="application/x-shockwave-flash">
</embed>
</object>
<SCRIPT LANGUAGE="JavaScript">
if (null == document.detection) {
location.href="nonflash.html";
}
</SCRIPT>
</body>
</html>
Can you find the difference ? :)
Note: There was no bug reports about that way -
we here testing it several months, but if there will be something wrong on your
site, you may always send URL and name of your browser to
www@ok.ru
-:)
2.Second problem is so called "caching problem".
In one case from 100 (or may be 1000) refresh to
nonflash.html
can become triggered (after jumping once to
nonflash.html,
it may continue jumping to
nonflash.html even after
installing Flash support). Just now I see only one way to fight against it -
cookies. So if you want to work with browsers without JavaScript support (like
mac/IE4.5), you have to use some kind of server scripts for it. And if you have
no server scripts support, you have to forget about that problem for mac/IE4.5...
Lets look at 3 ways to use cookies for solving this second problem:
Common JS way:
Ok :) Lets continue adding JS to our code. (you may also check
cookies.html
on this site for information)
First of all lets set cookie from our
nonflash.html.
It will look like:
<html>
<head>
<title>Html page</title>
<script language="JavaScript">
<!--
// everything after two slash lines is comment
howlong=new Date(); // Setting "howlong" variable
to current time
howlong.setTime(howlong.getTime() + 900000000); //adding
900000 sec to "howlong"
document.cookie = 'detection; expires=' + howlong.toGMTString();
//setting cookie
// -->
</script>
</head>
<body>
<center><h2>Flash support not detected</h2></center>
</body>
</html>
After it lets search for cookies from
detection.html,
and if it will be find refresh page and delete cookie.
<html>
<head>
<title>Detection Flash4 support</title>
<SCRIPT LANGUAGE="JavaScript">
<!--
if (!self.location.search && document.cookie) {
document.cookie = 'detection; expires = Mon, 7 Feb 2000 23:19:15 UTC';
location.href = "detection.html?refreshed";
}
// -->
</SCRIPT>
<meta HTTP-EQUIV="Refresh" CONTENT="8;URL=nonflash.html">
</head>
<body>
<p>
<center><h3>Please wait...</h3></center>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
ID="detection" WIDTH="2" HEIGHT="2">
<param NAME=movie VALUE="detection.swf">
<param NAME=quality VALUE=high>
<param NAME=bgcolor VALUE=#000000>
<embed src="detection.swf" quality="high" NAME="detection"
swLiveConnect="true"
bgcolor="#000000" WIDTH="2" HEIGHT="2"
TYPE="application/x-shockwave-flash">
</embed>
</object>
<SCRIPT LANGUAGE="JavaScript">
if (null == document.detection) {
setTimeout("location.href='nonflash.html'", 500);
}
</SCRIPT>
</body>
</html>
Here we have another possible caching problem - triggered refreshing. To fight
against it better to use
self.location.search (condition
!self.location.search mean that all actions inside
for will run only if there is nothing after ? in
url string.
Same things with PHP
here is nonflash.php
<?
setcookie("detection","passed",gmdate(time()) +100000);
?>
<html>
<head>
<title>Html page</title>
</head>
<body>
<center><h2>Flash support not detected</h2></center>
</body>
</html>
and detection.php
<?
if ($HTTP_COOKIE_VARS["detection"] && !$first) {
setcookie("detection","",gmdate(time()) - 100000);
header("Location: detection.php?first=passed");
}
?>
<html>
<head>
<title>Detection Flash4 support</title>
<meta HTTP-EQUIV="Refresh" CONTENT="6;URL=nonflash.php">
</head>
<body>
<p>
<center><h3>Please wait...</h3></center>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
ID="detection" WIDTH="2" HEIGHT="2">
<param NAME=movie VALUE="detection.swf">
<param NAME=quality VALUE=high>
<param NAME=bgcolor VALUE=#000000>
<embed src="detection.swf" quality="high" NAME="detection"
swLiveConnect="true"
bgcolor="#000000" WIDTH="2" HEIGHT="2"
TYPE="application/x-shockwave-flash">
</embed>
</object>
<SCRIPT LANGUAGE="JavaScript">
<!--
if (null == document.detection) {
setTimeout("location.href='nonflash.php'", 500);
}
// -->
</SCRIPT>
</body>
</html>
Same things with ASP
here is nonflash.asp
<%@LANGUAGE="VBSCRIPT"%>
<%
Response.Cookies("detection") = "passed"
Response.Cookies("detection").Expires=Date + 10000
%>
<html>
<head>
<title>Html page</title>
</head>
<body>
<center><h2>Flash support not detected</h2></center>
</body>
</html>
and detection.asp
<%@LANGUAGE="VBSCRIPT"%>
<%
dim first
first=Request.QueryString("first")
If Request.Cookies("detection") <> Empty and first = Empty Then
Response.Cookies("detection").Expires=Date - 100
Response.redirect ("detection.asp?first=passed")
End If
%>
<html>
<head>
<title>Detection Flash4 support</title>
<meta HTTP-EQUIV="Refresh" CONTENT="6;URL=nonflash.asp">
</head>
<body>
<p>
<center><h3>Please wait...</h3></center>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
ID="detection" WIDTH="2" HEIGHT="2">
<param NAME=movie VALUE="detection.swf">
<param NAME=quality VALUE=high>
<param NAME=bgcolor VALUE=#000000>
<embed src="detection.swf" quality="high" NAME="detection"
swLiveConnect="true"
bgcolor="#000000" WIDTH="2" HEIGHT="2"
TYPE="application/x-shockwave-flash">
</embed>
</object>
<SCRIPT LANGUAGE="JavaScript">
<!--
if (null == document.detection) {
setTimeout("location.href='nonflash.asp'", 500);
}
// -->
</SCRIPT>
</body>
</html>
And once more :)
If there will be any problems with all that stuff, my e-mail is www@ok.ru
:)
Back