Solved

Flash auto detection

Posted on 2000-04-12
8
229 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

706 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

12 Experts available now in Live!

Get 1:1 Help Now