i use technique described here: http://scriptasylum.com/tutorials/encode-decode.html
in nutshell, 1 has javascript file looks this, actual javascript encoded:
document.write( unescape( 'escaped string' ) ); df('encoded javascript');
i want run same .js module under nashorn, nashorn not have document object. therefore, can not document.write().
note: known technique bypassed , people modest technical ability can still @ actual code. use case not require strong security not concern. said, please consider answers on why 1 should not off topic. thanks.
basically, code breaks down 2 parts:
un-obfuscate string via
unescape
.write string out via
document.write.
it sounds want use string directly reason.
you have @ least 2 options:
you can provide
document
object scripting enginewrite
method accepts string. can like. (or substitutedocument.write
before evaluating string function want called.)remove
document.write(
, corresponding)
@ end , have engine evaluate string , hand directly result ofscriptengine#eval
.
either way, you'll end string can with.
Comments
Post a Comment