I want to use *.js file both: on local web page on my pc (as JavaScript) and as WSH JScript when I double click *.js file. Is it possible to write a code running on both platforms?
How to check is running JS file is JavaScript or Microsoft JScript?
I tried this, but it doesn't work:
if (typeof(document) == "undefined")
alert('WSH Script!');
WScript.Quit;
}
else {
document.writeln('Hello world');
}
window
object isn't present in the WSH environment, so you might try checking for that.--------------------------- Windows Script Host --------------------------- Script: D:\JS\plik js - oryg.js Line: 4 Char: 1 Error: Syntax error Code: 800A03EA Source: Microsoft JScript compilation error
I'm wondering is there something liketepeof
in JScript? Because it seams to be a problem...