Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 639 Vote(s) - 3.51 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Detect function's caller's ScriptEngine

#1
I'm trying to determine a function's result depending on the caller's ScriptEngine:

//JScript
function doSomething()
{
if (ScriptEngine() === "VBScript")
return "this is VBScript";
else
return "this is JScript";
}

But the results are:

//JScript
var str = doSomething(); //"this is JScript"

//VBScript
Dim str : str = DoSomething() '"this is JScript"

The `ScriptEngine()` function always returns its caller's engine name, but I would like to know the `doSomething()` caller's engine name (without passing it as a parameter). Is there any way to do this in ASP?

The motivation behind this is that I wrote a JSON utility class to use in an ASP site. The parsing of the JSON string is done via `eval` (using the validation that I found in [this](

[To see links please register here]

) answer).

The result of `eval` is a JScript object (with JScript arrays and JScript dates as properties). Then the user must specify a flag to tell the function if he wants the pure JScript object or if he wants a VBScript object (with arrays and dates converted to their VBScript equivalent). I would like to eliminate that parameter.

//JScript
function parseJson(jsonString, isJsObject)
{
var parsedObject = parsingLogic(jsonString);

if (!isJsObject) //Would like to replace by engine check
convertVbProperties(parsedObject);

return parsedObject;
}
Reply

#2
I ended up keeping the `isJsObject` parameter. Since we were using VBScript most of the time, and JScript was only being used to build libraries, that worked fine.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through