View Full Version : Browser/Res/Flash detection.

03-02-2003, 09:00 AM
Ok, I'm having trouble trying to make a scirpt that will detect a users browser, resoloution and flash plugin (if applicable).

I can do the res detection but I've no idea how to detect the browser and flash plugin.

How it has to work is ..

noComply = 0
BrowserVer =
Res = screen.Width+'x'+screen.Height
HasFlash =

if (BrowserVer < 5){
noComply ++

if (Res == '640x480'){
noComply ++

if (HasFlash !== true){
noComply ++

if (noComply > 0){
location = 'errorReport.asp?n='+noComply;

// User has to be here if they meet requirements

if (Res == '800x600'){
location == 'core?l=res2';

I just need to know how to find the browser version and the flash plugin.

Graeme Hackston
03-02-2003, 03:59 PM
They're all in this

<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">

body {cursor:hand}
<title>Checking your system...</title>

<script language=JavaScript>
// CheckSys v1.04.21-01 //
// //
// This JavaScript can be freely used as long as this message //
// stays here in the header of the script. Any modifications //
// and bugs found (and fixed) are appreciated. //
// Adding additional information of checking modules is //
// extremely appreciated and encouraged. //
// //
// Svetlin Staev, thewebmonster@altavista.com //
var place="#"; // Redirection page after check

//-----------------Initazing variables-------------------//
var jscript,vscript,language,resolution,colors,avalW,avalH,real,flash,browname,cookie;
var seq1="",seq2="";
var a=0,b=0,num=0;precent=0;
var realState=false;
var flashState=false;
var G2=false;
var FI=false;
var last=document.lastModified;
var historyP=history.length;
var dateP=new Date();
var ie=document.all?1:0;
var ns=document.layers?1:0;
var dom=document.getElementById?1:0;
var l=(ie||dom)?navigator.browserLanguage:navigator.language;
//-------------------End of variables-------------------//

//----------Cookie and JavaScript check module----------//
if (navigator.javaEnabled()>-1) jscript = "JavaScript present.";
else jscript = "JavaScript not present.";
if (navigator.cookieEnabled) cookie = "Cookies enabled.";
else cookie = "Cookies disabled.";
//--------------------End of module--------------------//

//----------Flash & Real Players check module----------//
numPlugins = navigator.plugins.length;
plugin = navigator.plugins[i];
if ((plugin.name.substring(0,10)=="RealPlayer")&&(plugin.name.indexOf("G2")>0)) realState=true;
if ((plugin.name.indexOf("Shockwave Flash")>-1)&&(plugin.description.indexOf("5")>-1)) flashState=true;

document.write('<script language=VBScript\> \n');
document.write('on error resume next \n');
document.write('G2 = (NOT IsNull(CreateObject("rmocx.RealPlayer G2 Control")))\n');
document.write('</script\> \n');
document.write('<script language=VBScript\> \n');
document.write('on error resume next \n');
document.write('FI = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
document.write('</script\> \n');
document.write('<script language=VBScript\>\non error resume next \nG2=(NOT IsNull(CreateObject("rmocx.RealPlayer G2 Control")))\n</script\>\n');
document.write('<script language=VBScript\>\non error resume next\nFI=(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4")))\n</script\>\n');

if (flashState||FI) flash = "Flash Player present."
else flash = "Flash Player missing."
if (realState||G2) real = "Real Player installed."
else real = "Real Player missing."
//--------------------End of module--------------------//

//------------------General info module----------------//
if (ie)
browname = "Microsoft Internet Explorer";
vscript = "VBScript present.";
avalW = screen.availWidth;
avalH = screen.availHeight;
else if (ns)
browname = "Netscape Navigator";
avalW = window.innerWidth;
avalH = window.innerHeight;
vscript = "VBScript missing.";
else if (dom)
browname = "Netscape 6 Gecko";
vscript = "VBScript missing.";
avalW = window.innerWidth;
avalH = window.innerHeight;
colors = screen.colorDepth;
resolution = ''+screen.width+' X '+screen.height+'';
//--------------------End of module--------------------//

function langInfo() // Detection of browser language
if (l.indexOf('en')>-1)language='English';
else if (l.indexOf('nl')>-1) language='Dutch';
else if (l.indexOf('fr')>-1) language='French';
else if (l.indexOf('de')>-1) language='German';
else if (l.indexOf('ja')>-1) language='Japanese';
else if (l.indexOf('it')>-1) language='Italian';
else if (l.indexOf('pt')>-1) language='Portuguese';
else if (l.indexOf('es')>-1) language='Spanish';
else if (l.indexOf('sv')>-1) language='Swedish';
else if (l.indexOf('zh')>-1) language='Chinese';
else language='English';


boot = 'Downloading..~~..~~..~..~.OK,~~ now booting the CheckSys.~~~<br>' // Splitting string used for Linux-like interface
+'CheckSys version 1.04.21-01~~ (thewebmonster@altavista.com)&nbsp; ~~# '+last+'<br>'
+'Connecting to client\'s computer...~~...~....~~~....~...~..Done.<br>'
+'Operation system found.<br>'
+'Client\'s browser platform: '+navigator.platform+'<br>'
+'Detected client browser.~~~<br>'
+'Getting browser name.......Browser name:~~ '+navigator.appCodeName+'<br>'
+'Decoding and ajusting browser name........Successful.<br>'
+'Common browser name: '+browname+'<br>'
+'Getting browser version..~...~..~~~..Done.<br>'
+'Browser version: '+navigator.appVersion+'<br>'
+'Checking browser history...........OK<br>'
+''+historyP+' PAGES found in browser history.~~<br>'
+'Autodetecting JavaScript..~.~.~.~.~..~.~.~.~.~.Done.<br>'
+'Looking for VBScript.~.~.~..~~..~.~..~.Done<br>'
+'Examining cookies.~.~.~..~~..~.~..~.<br>'
+'Logging in for additional information.~.~..~.~..~...~.Successfull.<br>'
+'Extracting client\'s date information...~.<br>'
+'Date: '+dateP+'~~~~<br>'
+'Language present in browser....~~...~..~.'+language+'<br>'
+'Screen resolution set to '+resolution+'<br>'
+'Getting color depth....~....~...~...'+colors+' bit<br>'
+'Estimating available browser space....~..~.~..Done. <br>'
+'Browser available width: '+avalW+' pixels<br>'
+'Browser available height: '+avalH+' pixels<br>'
+'Entering inside for plugins information.<br>'
+'Looking for Real Player.~~.~.~.~.~.~.~.~.~.~.~.Done.<br>'
+'Checking for Macromedia FLASH player.~.~.~.~.~.~.~.~.~.~.Done.<br>'
+'CheckSys operation complete.~~~<br>'
+'Now redirecting to proper web page~.~...~.~..~...~OK.~~~<br>';

seq = boot.split("~"); // Spliting the string

function initCheck() // The Linux-like boot simulation function
seq1='<tt>'+seq2+'<b style="color:silver">'+seq[num]+'</b></tt>';

if(ie) booty.innerHTML = seq1;
if(dom) document.getElementById("booty").innerHTML = seq1;
if (!(num>=seq.length-1))
window.status=precent+"% complete.";
if (precent<100)precent++;
else window.status="Checking completed."
else window.location.replace(place);
function down() // Scrolling down function
#booty {position:absolute;}

<body bgcolor=white text=black marginheight=5 marginwidth=5 topmargin=5 leftmargin=5>

<table cellpadding=0 cellspacing=0 border=0 width=100%>
<ilayer id=out width=95% height=95%>
<layer id=indoor width=95% height=95%>
<div id=booty></div>

03-03-2003, 12:05 AM
<script language="javascript" type="text/javascript">

if (navigator.appName == "Netscape") {
} else {
if (navigator.appName == "Microsoft Internet Explorer") {


03-03-2003, 04:55 AM
Never, never, never, never, never, never, never, never, never, never, never, never, never, never, never, never, never, never, never, never, never, never, never, never, never, never, never, never, never, never, never just do a search for Netscape. If you do, you block out countless browsers from your site.

if (document.layers) // Works for Netscape 4.x

if (navigator.userAgent.indexOf('Gecko') != -1)
// Searches for Netscape 6+ and all other related browsers that are essentially identical to Netscape 6+

Microsoft does that crap! They allow Netscape 6 & 7, but block out Mozilla, Phoenix, and others!

03-03-2003, 04:59 AM
haha, sorry. im kinda a newbie to javascript....thanks!