[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Flash auto detection

Posted on 2000-04-12
8
Medium Priority
?
253 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
LVL 2

Accepted Solution

by:
burntout earned 150 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
Suggested Courses

649 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