When researching JavaScript conditional comments for IE, I stumbled upon @cc_on. This seems to work. However, the wikipedia entry on conditional comments provides the following code for more robust IE detections, specifically IE6:
/*@cc_on
@if (@_jscript_version > 5.7)
document.write("You are using IE8+");
@elif (@_jscript_version == 5.7 && window.XMLHttpRequest)
document.write("You are using IE7");
@elif (@_jscript_version == 5.6 || (@_jscript_version == 5.7 && !window.XMLHttpRequest))
document.write("You are using IE6");
@elif (@_jscript_version == 5.5)
document.write("You are using IE5.5");
@else
document.write("You are using IE5 or older");
@end
@*/
The issue is, I'm getting an "expected constant" javascript error on !window.XMLHttpRequest
.
Clearly Wikipedia needs some help, and I need to get this working. Can anyone help me out?
if (!Function.prototype.call) { Function.prototype.call = foo; }
, etc., like Oz.js does: code.google.com/p/oz-js/source/browse/trunk/oz.js#224 – Stalactiteif (typeof window.XMLHttpRequest=="undefined") { /* code here */ }
– Hithermost