🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.javascript
Article #270

Re: czy jest mozliwe (flash) ?

#270
From: Tomasz Przetacki
Date: Tue, 08 Jan 2002 09:57
71 lines
3080 bytes
> Witam !!!
> Problem jest taki ...czy jest mozliwe zeby za pomoca js sprawdzic czy ktos
> ma plugin flasha i jesli ma to ladowac strone normalnie a jesli nie ma to
> rozpoczac monitowanie o pobranie..


Może to ci coś pomoże


var requiredVersion = 5;
var flash2Installed = false;
var flash3Installed = false;
var flash4Installed = false;
var flash5Installed = false;
var maxVersion = 5;
var actualVersion = 0;
var hasRightVersion = false;
var oeTags = '';

var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;

if (isIE && isWin) {
 document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
 document.write('on error resume next \n');
 document.write('flash2Installed =
(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
 document.write('flash3Installed =
(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
 document.write('flash4Installed =
(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
 document.write('flash5Installed =
(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');
 document.write('</SCR' + 'IPT\> \n');
}

function detectFlash()
{
 if (navigator.plugins) {
  if (navigator.plugins["Shockwave Flash 2.0"] ||
navigator.plugins["Shockwave Flash"]) {
   var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
   var flashDescription = navigator.plugins["Shockwave Flash" +
isVersion2].description;
   var flashVersion =
parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
   flash2Installed = flashVersion == 2;
   flash3Installed = flashVersion == 3;
   flash4Installed = flashVersion == 4;
   flash5Installed = flashVersion == 5;
  }
 }

 for (var i = 2; i <= maxVersion; i++) {
  if (eval("flash" + i + "Installed") == true) actualVersion = i;
 }

 if (actualVersion >= requiredVersion) hasRightVersion = true;

 if (hasRightVersion) {
  if (oeTagsFlash == 'brak') {
   oeTags = oeTagsGif
  } else {
   oeTags = oeTagsFlash;
  }
 } else {
  oeTags = oeTagsGif;
 }
}

detectFlash();
Technical Details
Message-ID: <a1efq6$c5r$1@news.tpi.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!mat.uni.torun.pl!news.man.torun.pl!news.man.poznan.pl!newsfeed.tpinternet.pl!news.tpi.pl!not-for-mail
References: <a1akgg$i1r$1@news.tpi.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!mat.uni.torun.pl!news.man.torun.pl!news.man.poznan.pl!newsfeed.tpinternet.pl!news.tpi.pl!not-for-mail
From: "Tomasz Przetacki" <przetacki@radio.com.pl>
Newsgroups: pl.comp.lang.javascript
Subject: Re: czy jest mozliwe (flash) ?
Date: Tue, 8 Jan 2002 10:57:25 +0100
Organization: tp.internet - http://www.tpi.pl/
Lines: 73
Message-ID: <a1efq6$c5r$1@news.tpi.pl>
References: <a1akgg$i1r$1@news.tpi.pl>
NNTP-Posting-Host: proxy-tp.radio.com.pl
X-Trace: news.tpi.pl 1010483848 12475 195.117.50.172 (8 Jan 2002 09:57:28 GMT)
X-Complaints-To: usenet@tpi.pl
NNTP-Posting-Date: Tue, 8 Jan 2002 09:57:28 +0000 (UTC)
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MSMail-Priority: Normal
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit