Friday, May 10, 2024
 Popular · Latest · Hot · Upcoming
186
rated 0 times [  191] [ 5]  / answers: 1 / hits: 22134  / 11 Years ago, sat, april 6, 2013, 12:00:00

I have encrypted my JavaScript Code with the base64 method like shown here. But when I run the encode function with document.ready, the JavaScript function doesn't do what it should.



How do I realize it, that the encrypted code will be decrypted and start to rund the function?



Thank you in advance! :)


More From » function

 Answers
88

Just use eval on the decoded string.



Example using the code alert(test);:



eval(decode64('YWxlcnQlMjglMjJ0ZXN0JTIyJTI5JTNC'));


Demo: http://jsfiddle.net/uFxnz/



Note: Using the eval function is associated with unsafe and inefficient code, but in this case you have as much control over where the code is coming from as you can, so it's doing just what you want it to do.


[#79084] Thursday, April 4, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
mireyag

Total Points: 73
Total Questions: 107
Total Answers: 85

Location: Ukraine
Member since Sun, Dec 13, 2020
3 Years ago
mireyag questions
Sun, Aug 15, 21, 00:00, 3 Years ago
Wed, Dec 16, 20, 00:00, 3 Years ago
Tue, Sep 1, 20, 00:00, 4 Years ago
Sun, Jul 5, 20, 00:00, 4 Years ago
;