views:

42

answers:

1

Possible Duplicate:
How can I obfuscate JavaScript?

I have been working on a web app in JavaScript. Nearing complete.

How do I protect me JavaScript code from someone copying it? I mean if you view my page source, it references the .js files and one could really steal these.

Should I be using something else? RoR?

Does Google Maps have a RoR API?

+3  A: 

Your closest bet would be to use something like

People will still be able to steal and use your code though, it will just be harder to modify.

Marko
Important to note that none of these will stop someone from using that javascript.
Yup I've added that in.
Marko
I'd add a caveat to this....I would say this makes it marginally *if at all* harder if the person looking knows what they're doing.
Nick Craver
Thanks @Nick, I'm not even going to bother to prove you wrong, but it can't certainly be easy to read something like: `var _0x70fa=["\x61\x73\x6B\x31","\x0A","\x4F\x4B"];var a=_0x70fa[0];function s(_0xd48bx3){alert(_0xd48bx3+_0x70fa[1]+a);} ;s(_0x70fa[2]);` though you could use another tool to convert it back to sane Javascript.
Marko
@Marko - Sure it is, paste here: http://jsbeautifier.org/ Hit beautify, instantly: `var a = 'ask1'; function s(_0xd48bx3) { alert(_0xd48bx3 + '\x0A' + a); }; s('OK');`. Wacky variable name, but hard to figure out? not really :) I didn't say no tools were involved, just that's it's trivial to "unobfuscate" the code.
Nick Craver
Amen to that @Nick. All I'm saying it adds an extra step in reading the code since it has to go through a beautifier and maybe some manual labor. Please don't reply, you're 100% right :)
Marko