Javascript does not provide a mechanism for loading an object in any form other than simple lines.
The closest thing you can do is serialize the object into a string, optionally encrypt / compress it, send it to the browser and decrypt / decompress if necessary, check if it works properly, eval () and pray ().
Instead of using eval (which is not entirely safe), you can use your own format (alternatively, xml or json, for which there are many libraries) and analyze it yourself.
As a side note, if you want this to obfuscate after the browser receives usable data (after decryption / decompression), this is too easy to get around.
artificialidiot Nov 29 '08 at 23:46 2008-11-29 23:46
source share