Created
April 24, 2012 12:27
-
-
Save paddycarver/2479231 to your computer and use it in GitHub Desktop.
Canisius Browser Check Page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<!-- written by an intern from the past. Email [email protected] for help if things go wrong or need updating. --> | |
<title>Browser Check</title> | |
<style type="text/css"> | |
body { | |
font-family: arial; | |
} | |
#checkContainer { | |
min-width: 275px; | |
width: 275px; | |
} | |
#brows {} | |
#browsPic { | |
float: left; | |
width: 55px; | |
} | |
#browsDescrip { | |
float: left; | |
/*width: 210px;*/ | |
} | |
#browsDescrip p { | |
color: #666; | |
font-size: 10pt; | |
margin: 0px; | |
padding: 0px; | |
} | |
#plugCheck { | |
margin-top: 5px; | |
} | |
#plugCheck p { | |
font-size: 10pt; | |
color: #666; | |
padding: 0px; | |
margin: 0px; | |
} | |
.plug { | |
vertical-align: middle; | |
} | |
.no { | |
margin-right: 5px; | |
} | |
.error a { | |
color: #990000; | |
text-decoration: underline !important; | |
} | |
</style> | |
<script type="text/javascript" src="http://www3.canisius.edu/~itsdocs/angel_testing/insecure_test.js"></script> | |
<script type="text/javascript"> | |
var iconRoot = 'https://angel.canisius.edu/Portal/Nuggets/NewSystemCheck/icons/'; | |
var BrowserDetect = { | |
init: function () { | |
this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; | |
this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version"; | |
this.OS = this.searchString(this.dataOS) || "an unknown OS"; | |
}, | |
searchString: function (data) { | |
for (var i=0;i<data.length;i++) { | |
var dataString = data[i].string; | |
var dataProp = data[i].prop; | |
this.versionSearchString = data[i].versionSearch || data[i].identity; | |
if(data[i].icon) { | |
this.icon = data[i].icon; | |
} | |
if (dataString) { | |
if (dataString.indexOf(data[i].subString) != -1) | |
return data[i].identity; | |
} else if (dataProp) | |
return data[i].identity; | |
} | |
if(this.icon = null) { | |
this.icon = "unknown.png"; | |
} | |
}, | |
searchVersion: function (dataString) { | |
var index = dataString.indexOf(this.versionSearchString); | |
if (index == -1) return; | |
return parseFloat(dataString.substring(index+this.versionSearchString.length+1)); | |
}, | |
dataBrowser: [ | |
{ | |
string: navigator.userAgent, | |
subString: "Chrome", | |
identity: "Chrome", | |
icon: "chrome.png" | |
}, | |
{ | |
string: navigator.userAgent, | |
subString: "OmniWeb", | |
versionSearch: "OmniWeb/", | |
identity: "OmniWeb", | |
icon: "omniweb.png" | |
}, | |
{ | |
string: navigator.vendor, | |
subString: "Apple", | |
identity: "Safari", | |
versionSearch: "Version", | |
icon: "safari.png" | |
}, | |
{ | |
prop: window.opera, | |
identity: "Opera", | |
icon: "opera.png" | |
}, | |
{ | |
string: navigator.vendor, | |
subString: "iCab", | |
identity: "iCab", | |
icon: "icab.png" | |
}, | |
{ | |
string: navigator.vendor, | |
subString: "KDE", | |
identity: "Konqueror", | |
icon: "konqueror.png" | |
}, | |
{ | |
string: navigator.userAgent, | |
subString: "Firefox", | |
identity: "Firefox", | |
icon: "firefox.png" | |
}, | |
{ | |
string: navigator.vendor, | |
subString: "Camino", | |
identity: "Camino", | |
icon: "camino.png" | |
}, | |
{ // for newer Netscapes (6+) | |
string: navigator.userAgent, | |
subString: "Netscape", | |
identity: "Netscape", | |
icon: "netscape.png" | |
}, | |
{ | |
string: navigator.userAgent, | |
subString: "MSIE", | |
identity: "Explorer", | |
versionSearch: "MSIE", | |
icon: "ie.png" | |
}, | |
{ | |
string: navigator.userAgent, | |
subString: "Gecko", | |
identity: "Mozilla", | |
versionSearch: "rv", | |
icon: "mozilla.png" | |
}, | |
{ // for older Netscapes (4-) | |
string: navigator.userAgent, | |
subString: "Mozilla", | |
identity: "Netscape", | |
versionSearch: "Mozilla", | |
icon: "mozilla.png" | |
} | |
], | |
dataOS : [ | |
{ | |
string: navigator.platform, | |
subString: "Win", | |
identity: "Windows" | |
}, | |
{ | |
string: navigator.platform, | |
subString: "Mac", | |
identity: "Mac" | |
}, | |
{ | |
string: navigator.userAgent, | |
subString: "iPhone", | |
identity: "iPhone/iPod" | |
}, | |
{ | |
string: navigator.platform, | |
subString: "Linux", | |
identity: "Linux" | |
} | |
] | |
}; | |
// Plugins that can be tested by MIME | |
var flash = new Object(); | |
flash.enabled = false; | |
flash.mime = "application/x-shockwave-flash"; | |
flash.identifier = "flash"; | |
flash.correctURL = "http://get.adobe.com/flashplayer/"; | |
flash.icon = "flash24.gif"; | |
flash.activeX = "ShockwaveFlash.ShockwaveFlash"; | |
var quicktime = new Object(); | |
quicktime.enabled = false; | |
quicktime.mime = "video/quicktime"; | |
quicktime.identifier = "quicktime"; | |
quicktime.correctURL = "http://www.apple.com/quicktime/download/"; | |
quicktime.icon = "quicktime24.gif"; | |
quicktime.activeX = "QuickTime.QuickTime"; | |
var windowsMedia = new Object(); | |
windowsMedia.enabled = false; | |
windowsMedia.mime = "video/x-ms-wmv"; | |
windowsMedia.identifier = "windowsMedia"; | |
windowsMedia.correctURL = {"Windows":"http://port25.technet.com/pages/windows-media-player-firefox-plugin-download.aspx", "Mac":"http://www.microsoft.com/windows/windowsmedia/player/wmcomponents.mspx"}; | |
windowsMedia.correctURL['default'] = windowsMedia.correctURL['Windows']; | |
windowsMedia.icon = "winmedia24.gif"; | |
windowsMedia.activeX = "MediaPlayer.MediaPlayer"; | |
var pdf = new Object(); | |
pdf.enabled = false; | |
pdf.mime = "application/pdf"; | |
pdf.identifier = "pdf"; | |
pdf.correctURL = "http://get.adobe.com/reader/"; | |
pdf.icon = "acrobat24.gif"; | |
pdf.activeX = ["AcroPDF.PDF", "PDF.PdfCtrl"] | |
// Non-plugins or plugins that can't be tested by MIME | |
var ajax = new Object(); | |
ajax.enabled = false; | |
ajax.identifier = "ajax"; | |
var java = new Object(); | |
java.enabled = false; | |
java.identifier = "java"; | |
java.correctURL = "http://java.com/getjava/"; | |
var security = new Object(); | |
security.enabled = true; | |
security.identifier = "security"; | |
var popups = new Object(); | |
popups.enabled = false; | |
popups.identifier = "popups"; | |
popups.onClick = "javascript:popupsBlockedNotification();"; | |
popups.correctURL = "#"; | |
var javascript = new Object(); | |
javascript.enabled = true; | |
var testMimeObjects = [ | |
flash, | |
quicktime, | |
windowsMedia, | |
]; | |
var mimeObjectsPassed = 0; | |
var plugins = [ | |
flash, | |
quicktime, | |
windowsMedia, | |
pdf, | |
ajax, | |
java, | |
security, | |
popups | |
]; | |
function mimeTest() { | |
if(navigator.mimeTypes && navigator.mimeTypes.length) { | |
for(y=0; y < testMimeObjects.length; y++) { | |
for(x=0; x < navigator.mimeTypes.length; x++) { | |
if(navigator.mimeTypes[x].type.indexOf(testMimeObjects[y].mime) != -1) { | |
testMimeObjects[y].enabled = true; | |
mimeObjectsPassed += 1 / testMimeObjects.length; | |
break; | |
} | |
} | |
} | |
} | |
if(mimeObjectsPassed != 1){ | |
for(y=0; y < testMimeObjects.length; y++) { | |
if(testMimeObjects[y].enabled) { | |
}else{ | |
if(testMimeObjects[y].activeX.constructor.toString().indexOf("Array") == -1) { | |
try { | |
var activeX = new ActiveXObject(testMimeObjects[y].activeX); | |
testMimeObjects[y].enabled = true; | |
} catch(e) { | |
} | |
}else{ | |
for(a = 0; a < testMimeObjects[y].activeX.length; a++) { | |
try { | |
var activeX = new ActiveXObject(testMimeObjects[y].activeX[a]); | |
testMimeObjects[y].enabled = true; | |
} catch(e) { | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
function ajaxTest() { | |
if(XMLHttpRequest){ | |
ajax.enabled = true; | |
} | |
} | |
function javaTest() { | |
java.enabled = navigator.javaEnabled(); | |
} | |
function popupsTest() { | |
var mine = window.open('','','width=1,height=1,left=0,top=0,scrollbars=no'); | |
if(mine){ | |
popups.enabled = true; | |
mine.close(); | |
} | |
} | |
function popupsBlockedNotification() { | |
alert('One or more popup blockers have been detected. Please configure your web browser to accept popup windows. For more information please refer to the help resource entitled "Disabling Popup Blockers"'); | |
return false; | |
} | |
function securityTest() { | |
try { | |
if(insecureAllowed) { | |
security.enabled = true; | |
} | |
} catch(e) { | |
security.enabled = false; | |
} | |
} | |
mimeTest(); | |
ajaxTest(); | |
javaTest(); | |
popupsTest(); | |
securityTest(); | |
BrowserDetect.init(); | |
</script> | |
</head> | |
<body> | |
<div id="browserAndPluginCheck" style="width: 280px; border: 1px solid black;"> | |
<div id="javascriptDisabledContainer" style="display: none; "> | |
<h4 style="color: red;"> | |
Javascript is disabled. Please enable Javascript in your browser to use ANGEL. | |
</h4> | |
</div> | |
<div id="javascriptEnabledContainer" style=""> | |
<div id="browserInfoContainer" style=""> | |
<div id="brows"> | |
<div id="browsPic"> | |
<img id="browserImage"> | |
</div> | |
<div id="browsDescrip"> | |
<p>Browser: <span id="browserInfo" style="font-weight: bold;"></span></p> | |
<p>Platform: <span id="OSInfo" style="font-weight: bold;"></span></p> | |
<p>Resolution: <span id="resolutionInfo" style="font-weight: bold;"></span> <span id="coloursInfo"></span></p> | |
</div> | |
<div style="clear: both;"></div> | |
</div> | |
</div> | |
<div id="checkContainer"> | |
<div> | |
<p> | |
<span style="font-size: 9pt;">See a Red X? Click the corresponding link to download it.</span> | |
</p> | |
</div> | |
<div id="plugCheck"> | |
<table> | |
<tbody><tr> | |
<th><b>Required</b></th> | |
<th><b>Suggested</b></th> | |
</tr> | |
<tr> | |
<td> | |
<p><img id="ajax_check"> <span id="ajax_text">AJAX</span></p> | |
</td> | |
<td> | |
<p><img id="pdf_check"> <img id="pdf_icon"> <span id="pdf_text">Acrobat Reader</span></p> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<p><img id="java_check"> <span id="java_text">Java</span></p> | |
</td> | |
<td> | |
<p><img id="flash_check"> <img id="flash_icon"> <span id="flash_text">Flash</span></p> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<p><img id="security_check"> <span id="security_text">Security Settings</span></p> | |
</td> | |
<td> | |
<p><img id="quicktime_check"> <img id="quicktime_icon"> <span id="quicktime_text">QuickTime</span></p> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<p><img id="popups_check"> <span id="popups_text">Popups</span></p> | |
</td> | |
<td> | |
<p><img id="windowsMedia_check"> <img id="windowsMedia_icon"> <span id="windowsMedia_text">Windows Media</span></p> | |
</td> | |
</tr> | |
</tbody></table> | |
</div> | |
</div> | |
<table> | |
<tbody><tr> | |
<td colspan="2"> | |
<br>ANGEL will function as long as your computer has the <b>4 Required components.</b><br> | |
</td> | |
</tr> | |
<tr> | |
<td colspan="2"> | |
Some courses may also include content that will need one or more of the Suggested items. For the best experience, consider installing the <b>4 Suggested plug-ins</b> as well. | |
</td> | |
</tr> | |
</tbody></table> | |
</div> | |
<script> | |
if(javascript.enabled) { | |
//hide the "You need to enable Javascript message" | |
document.getElementById("javascriptDisabledContainer").style.display = "none"; | |
//show the Browser and Plugin info | |
document.getElementById("javascriptEnabledContainer").style.display = ""; | |
document.getElementById("browserImage").src = iconRoot + BrowserDetect.icon; | |
document.getElementById("browserInfo").innerHTML = BrowserDetect.browser + " version " + BrowserDetect.version; | |
document.getElementById("OSInfo").innerHTML = BrowserDetect.OS; | |
document.getElementById("resolutionInfo").innerHTML = screen.width + 'x' + screen.height; | |
document.getElementById("coloursInfo").innerHTML = '(' + screen.colorDepth + 'bit color)'; | |
// Populate the Browser and Operating System information | |
document.getElementById("checkContainer").style.display = ""; | |
// two variables to make switching icons easier | |
var enabledIcon = "yes.gif"; | |
var disabledIcon = "no.gif"; | |
// the class assigned to text when the check fails | |
var errorClass = "error"; | |
// loops through the plugins, and assigns the appropriate icons to them | |
// as well as adds links when the check failed. | |
for(p = 0; p < plugins.length; p++){ | |
var plugin = plugins[p]; | |
if(plugin.icon != null) { | |
document.getElementById(plugin.identifier+"_icon").src = iconRoot + plugin.icon; | |
} | |
var checkIcon = document.getElementById(plugin.identifier+"_check"); | |
if(plugin.enabled) { | |
checkIcon.src = iconRoot + enabledIcon; | |
}else{ | |
checkIcon.src = iconRoot + disabledIcon; | |
var checkText = document.getElementById(plugin.identifier+"_text"); | |
checkText.setAttribute("class", errorClass); | |
if(plugin.correctURL != null) { | |
var pluginURL = ""; | |
if(typeof(plugin.correctURL) == "object"){ | |
if(plugin.correctURL[BrowserDetect.OS]) { | |
pluginURL = plugin.correctURL[BrowserDetect.OS]; | |
}else if(plugin.correctURL['default']) { | |
pluginURL = plugin.correctURL['default']; | |
} | |
}else{ | |
pluginURL = plugin.correctURL; | |
} | |
if(plugin.identifier != "popups") { | |
var linkTitle = "Click here to download " + checkText.innerHTML; | |
}else{ | |
var linkTitle = ""; | |
} | |
var target = "target=\"_blank\""; | |
if(plugin.onClick != null) { | |
var onClick = "onClick=\""+plugin.onClick+"\" "; | |
target = ""; | |
}else{ | |
var onClick = ""; | |
} | |
checkText.innerHTML = "<a href=\"" + pluginURL +"\" title=\"" + linkTitle + "\" "+onClick+target+">" + checkText.innerHTML + "</a>"; | |
} | |
} | |
} | |
} | |
</script> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment