Solved

Flash auto detection

Posted on 2000-04-12
8
239 Views
Last Modified: 2010-04-03
Hi!

I just started to use Flash and I'ld really like to find out how you can  build a website that autodetects if you have Flash installed - if yes, load Flash animation, if no, possibility to download Flash.
I've tried the built-in option in Flash (with publication settings) but the results weren't quite satisfactory.

Thanx.
0
Comment
Question by:Yogey
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 3

Expert Comment

by:SuperMario
ID: 2710376
Here's the code from hydrarig.com (my favorite reference site for Flash detection, made by me)

Open up your HTML page that has the Flash in it and find the tag that says <HEAD>. If there is no <HEAD> tag, add everything below between a <HEAD> and </HEAD> tag... however you do it, the code below must be between a <HEAD> and </HEAD> tag.

<SCRIPT>
<!--
function validateFlash()
{
      browser = navigator.appName;
      ver = parseInt(navigator.appVersion);
      var hasPlugin;
      if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) {
      if (navigator.plugins && navigator.plugins["Shockwave Flash"])
            hasPlugin = 1;
      }

      if((browser = "Microsoft Internet Explorer" && ver >= 4) || (hasPlugin == 1))
      {
            self.navigate("FrameFlash.html");
      }
      else
      {
            self.navigate("noflash.html");
      }
}
//-->
</SCRIPT>

Then find your <BODY> tag. It should either just say <BODY> or have a bunch of attributes like <BODY BGCOLOR="blah"> etc.

Add an attribute so that your body tag looks like

<BODY onLoad="setTimeout('validateFlash()', 1000">

Leave any other attributes in there but add the onLoad attribute.

This will cause your page to detect Flash via javascript.

If you need more help lemme know =)

-Dan
0
 

Author Comment

by:Yogey
ID: 2715919
Your code works excellent in Explorer but causes a javascript error in Netscape. I found out it has something to do with the "self.navigate" portion. Do you know a solution for this?
0
 

Author Comment

by:Yogey
ID: 2715948
Your code works excellent in Explorer but causes a javascript error in Netscape. I found out it has something to do with the "self.navigate" portion. Do you know a solution for this?
0
 
LVL 3

Expert Comment

by:SuperMario
ID: 2717673
Hmm. I have been told this before also.

Does it give you the same problem if you change it to navigateURL instead of navigate?

Give that a shot =)

-D

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 2

Accepted Solution

by:
burntout earned 50 total points
ID: 2718583
This is what it says to do at macromedia.com (Creaters of Flash)

You should make a new animation that is
18x18 with 2 frames, on the second frame you add a GetURL Action and set it to the "Flash Page" this way the only way they will get redirected to this page is if they have flash. you place this animation on the first page of your site, you also add a meta refresh that will redirect the user in (10 seconds says macromedia but I use 5) this way if the movie does not load and redirect the user in less then 10 seconds they will be redirected to the "Noflash page" Here is a link to the actual macromedia page with this info.
http://macromedia.com/support/flash/ts/documents/scriptfree_detection.htm

I use this and it works great.. if you want to see my site is at...
http://www.323tech.com

good luck!
0
 
LVL 2

Expert Comment

by:coopa
ID: 2725698
Have a look at www.assembly-line.co.uk, I have a page that not only detects the flash version, but then tells the user what version they have.  

It then forwards them on to a flash 4 version if they have flash 4 or a text version if they have any other version of flash or no flash at all.

This works in NSN and IE browsers.

----------------------------------

 <SCRIPT LANGUAGE="JavaScript">
flashver=0

var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] ?
      navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0);
if (plugin && parseInt(plugin.description.substring(plugin.description.indexOf(".")-1)) >= 4) {
 flashver=4
}

if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0
   && (navigator.userAgent.indexOf("Windows")>=0 && navigator.userAgent.indexOf("3.1")<0)) {
document.write('\<SCRIPT LANGUAGE=VBScript\> \n');
        document.write('on error resume next ');
        document.write('\n');
document.write('If IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3")) Then ');
document.write('\n');
document.write('flashver = 3 ');
document.write('\n');
document.write('End If ');
document.write('\n');
document.write('If IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4")) Then ');
document.write('\n');
document.write('flashver = 4 ');
document.write('\n');
document.write('End If ');
document.write('\n');
        document.write('\<\/SCRIPT\> ');
        document.write('\n');
}

if (flashver > 2)
{document.write('&lt Flash Version ');
document.write(flashver);
document.write(' detected &gt')};

if (flashver > 3)
{location.href="http://www.flash4version.com"}
else
{location.href="http://www.textversion.com"};

</SCRIPT>
0
 
LVL 2

Expert Comment

by:coopa
ID: 2725709
PS.  This script should sit in the body of your html file, not in the head like most scripts.


<html>
<head>
<title>test</title>
</head>
<body>

Your page here

<script>  My script here  </script>

</body>
</html>
0
 

Author Comment

by:Yogey
ID: 2725765
I've accepted this answer because it seems to be working best.
The other scripts only work partially - just in Explorer and not in Netscape or just on PC's and not on a Mac(!)

Thanx to all of you.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Microsoft WSUS 4 90
How to determine issues pulling up internal device in browser. 5 82
Java and adobe flash updates 4 44
Play RTMP without Flash 3 432
Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now