I am trying to write a javascript program that can be called from either WScript or a browser (embedded in html). Many javascript functions are independent of the type of caller, but not the debugging functions, such as "window.write" or "WScript.alert".
I am aware that javascript functions can determine the name of their caller, but not javascript main programs.
Case 1: caller is WScript, WScript sample.js
Case 2: caller is browser,
How can sample.js determine whether it was called by WScript or a browser?