/* "Poll ID" Script, Copyright (C) the electrohippie collective 2006 the purpose of the following JavaScript code is to detect whether the browser being used to access the page is one of a list of 'proprietary' browsers, and alert the user to the dangers of using such browsers. This code is released under the Gnu General Public License */ // POLLID() -- browser ID test function function pollid() { // declare variables var alert_text = ""; var ctr = 0; var list = new Array(); var name = navigator.appName; var ptr = 0; var referral = ""; var retval = false; // initialise variables alert_text = "BROWSER ALERT!!\n\nYou appear to be using a browser " + "based on proprietary software.\n\nThis could compromise " + "your free access to the Internet at some time in the " + "future\n\nTo find out why this is a problem click 'OK', " + "otherwise click 'Cancel'.\n\n"; list[ 0] = "Microsoft"; referral = "http://www.fraw.org.uk/ehippies/browser-alert/browser_freedom_alert.html"; /* scan the list of strings for a match -- if a match is found increment the counter */ for ( ptr = 0; ptr < list.length; ptr++) { if ( name.indexOf( list[ptr]) > -1) { ctr++; } } /* if the counter is greater than zero ("match found") call the confirm() dialog to display the alert message and redirect the user (if desired) */ if ( ctr > 0) { retval = confirm( alert_text); if ( retval == true) { window.location.href = referral; } } } // WHATAMI() -- browser ID information function function whatami() { // declare variables var data = new Array(); var ptr = 0; var str = ""; var text = new Array(); // initialise variables data[ 0] = navigator.appName; data[ 1] = navigator.appVersion; data[ 2] = navigator.appCodeName; data[ 3] = navigator.userAgent; text[ 0] = "Your browser revealed the following identification:"; text[ 1] = "Browser name... "; text[ 2] = "Version ID........ "; text[ 3] = "Code name...... "; text[ 4] = "User agent ID.. "; /* composite report string */ for (ptr = 0; ptr < 5; ptr++) { if (ptr == 0) { str = text[ 0] + "\n"; } else { str = str + text[ ptr] + data[ ptr - 1] + "\n"; } } /* display report string */ alert( str); }