SitePoint Sponsor |
|
User Tag List
Results 1 to 14 of 14
Thread: detecting flash
-
Mar 26, 2001, 15:25 #1
- Join Date
- Aug 1999
- Location
- East Lansing, MI USA
- Posts
- 12,937
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I need to write a script that detects if a person has flash installed and if they do then do something, if not do something else.
I can do this no problem with javascript - except for the detecting flash part. I have no idea how to have a js detect flash - or even if its possible.Chris Beasley - I publish content and ecommerce sites.
Featured Article: Free Comprehensive SEO Guide
My Guide to Building a Successful Website
My Blog|My Webmaster Forums
-
Mar 26, 2001, 15:31 #2
- Join Date
- Sep 2000
- Location
- Birmingham, AL
- Posts
- 120
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I've had the same problem...but I ended up doing a redirect using flash...
http://www.macromedia.com/support/fl..._detection.htmJoseph Schell
AMICO-Online
-
Mar 26, 2001, 15:39 #3
- Join Date
- Aug 1999
- Location
- East Lansing, MI USA
- Posts
- 12,937
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I dont need to do a redirect.
This is for a flash advertisement that I want to popup in a new window. And I also need to set a cookie when I pop it up too. But I only want the window to popup if the user has flash installed.Chris Beasley - I publish content and ecommerce sites.
Featured Article: Free Comprehensive SEO Guide
My Guide to Building a Successful Website
My Blog|My Webmaster Forums
-
Mar 26, 2001, 15:42 #4
- Join Date
- Aug 1999
- Location
- East Lansing, MI USA
- Posts
- 12,937
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
nevermind - found it
Code:<SCRIPT LANGUAGE="JavaScript"> <!-- use this comment tag to hide the enclosed code from old browsers. //Look for a version of Internet Explorer that supports ActiveX (i.e., one that's //running on a platform other than Mac or Windows 3.1) or a browser that supports //the plugin property of the navigator object and that has Flash Player 2.0 //installed. if ((navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.indexOf("Mac") == -1 && navigator.appVersion.indexOf("3.1") == -1) || (navigator.plugins && navigator.plugins["Shockwave Flash"]) || navigator.plugins["Shockwave Flash 2.0"]){ //Load a pre-defined HTML page with Flash Player in it into the browser window. window.location='flashed.html'; } else { //Load a pre-defined HTML page without Flash Player into the browser window. window.location='nonflashed.html'; } // Close the comment tag. --> </SCRIPT>
Chris Beasley - I publish content and ecommerce sites.
Featured Article: Free Comprehensive SEO Guide
My Guide to Building a Successful Website
My Blog|My Webmaster Forums
-
Mar 26, 2001, 16:48 #5
- Join Date
- Aug 1999
- Location
- East Lansing, MI USA
- Posts
- 12,937
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
if (navigator.mimeTypes && navigator.mimeTypes.length)
{
x = navigator.mimeTypes['application/x-shockwave-flash'];
if (x && x.enabledPlugin) flashinstalled = 2;
else flashinstalled = 1;
}
This wont work for NS.
And yes it has both javascript and flash installed - and I double checked and it has that correct mime type so why wont this work?Chris Beasley - I publish content and ecommerce sites.
Featured Article: Free Comprehensive SEO Guide
My Guide to Building a Successful Website
My Blog|My Webmaster Forums
-
Mar 26, 2001, 17:52 #6
- Join Date
- Jul 1999
- Location
- SC, USA
- Posts
- 390
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Check this out:
http://javascriptcity.com/forums/sho...?threadid=2215
The script you have for IE actually just says if it's IE above this version, it's ok, but what the script I posted does is checks for IE, and it also uses navigator.plugins[] to check for NN.
aDogModerator at www.javascriptcity.com/forums/
-
Mar 26, 2001, 19:30 #7
- Join Date
- Aug 1999
- Location
- East Lansing, MI USA
- Posts
- 12,937
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Code:if(navigator.appName=="Netscape"){ var fb=navigator.plugins["Shockwave Flash"].description; var fv=Math.round(fb.charAt(fb.indexOf(".") - 1)); if(fv==5){ youhaveflash(); }else{ noflash(); }}else{ var swf = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.5'); if(swf){ youhaveflash(); }else{ noflash(); }} </script>
I use the same criteria in scripts above and it does not work.Chris Beasley - I publish content and ecommerce sites.
Featured Article: Free Comprehensive SEO Guide
My Guide to Building a Successful Website
My Blog|My Webmaster Forums
-
Mar 26, 2001, 22:46 #8
- Join Date
- Jul 1999
- Location
- SC, USA
- Posts
- 390
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hey,
Are you sure my script doesn't work...I'm almost sure it has in the past for many people.
aDogModerator at www.javascriptcity.com/forums/
-
Mar 27, 2001, 06:47 #9
- Join Date
- Aug 1999
- Location
- East Lansing, MI USA
- Posts
- 12,937
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Well - actually yes it does work.
I wonder why mine didn't.Chris Beasley - I publish content and ecommerce sites.
Featured Article: Free Comprehensive SEO Guide
My Guide to Building a Successful Website
My Blog|My Webmaster Forums
-
Mar 27, 2001, 07:02 #10
- Join Date
- Aug 1999
- Location
- East Lansing, MI USA
- Posts
- 12,937
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Code:var flashinstalled = 0; if(navigator.appName=="Netscape"){ if(navigator.plugins["Shockwave Flash"]){ flashinstalled = 2; }} if(flashinstalled == 2){ alert("You have Flash"); DisplayInfo(); }
If I move the alert up into the other if statement I get the alert, but down where it is I don't - and I don't get the function either.Chris Beasley - I publish content and ecommerce sites.
Featured Article: Free Comprehensive SEO Guide
My Guide to Building a Successful Website
My Blog|My Webmaster Forums
-
Mar 27, 2001, 07:07 #11
- Join Date
- Aug 1999
- Location
- East Lansing, MI USA
- Posts
- 12,937
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
now nothing works again.
Code:if(navigator.appName=="Netscape"){ if(navigator.plugins["Shockwave Flash"]) { alert("You have Flash"); }else{ alert("You don't have Flash"); }}
Chris Beasley - I publish content and ecommerce sites.
Featured Article: Free Comprehensive SEO Guide
My Guide to Building a Successful Website
My Blog|My Webmaster Forums
-
Mar 27, 2001, 10:34 #12
- Join Date
- Aug 1999
- Location
- East Lansing, MI USA
- Posts
- 12,937
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I removed all the rest of the js from the page and still it doesn't work....
Chris Beasley - I publish content and ecommerce sites.
Featured Article: Free Comprehensive SEO Guide
My Guide to Building a Successful Website
My Blog|My Webmaster Forums
-
Mar 27, 2001, 10:44 #13
- Join Date
- Jul 1999
- Location
- SC, USA
- Posts
- 390
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hey,
I really have no reason why those wouldn't work for you. I'm not the best with plug-ins, but I'll assume your code is correct. Here's how I'd do it ... one of two ways. Hopefully both of them should work.
Code:var flashinstalled = 0; if(navigator.appName=="Netscape" && navigator.plugins["Shockwave Flash"]){ flashinstalled = 1; } if(flashinstalled){ alert("You have Flash"); DisplayInfo(); }
Code:if(navigator.appName=="Netscape" && navigator.plugins["Shockwave Flash"]){ alert("You have Flash"); DisplayInfo(); }
aDogModerator at www.javascriptcity.com/forums/
-
Mar 27, 2001, 10:45 #14
- Join Date
- Aug 1999
- Location
- East Lansing, MI USA
- Posts
- 12,937
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
its actually working now.
Don't you love netscape inconsistencies?Chris Beasley - I publish content and ecommerce sites.
Featured Article: Free Comprehensive SEO Guide
My Guide to Building a Successful Website
My Blog|My Webmaster Forums
Bookmarks