The shortest way I was able to do this was as follows (maybe a cleaner way, but I don't know VBScript, I just know Modernizr).
var supportsVb = (function() {
var supports = false;
var vb = document.createElement('script');
vb.type="text/vbscript";
try {
vb.innerText="Err.Raise";
} catch (e) {
supports = true;
}
return supports
})()
The idea is that only vbscript drivers will raise an error for this syntax.
It can be used as follows:
if (supportsVb) {
} else {
}
source
share