A technique for hiding your JavaScript code
patrick-wied.at
patrick-wied.at
Also, this seems like a surprisingly naive generalisation to me: "... a first measurement for preventing evil business guys from stealing your code – developers who can figure the code out are (mostly) kind enough not to steal it."
The classic view source showing just text is a very powerful message: websites are just text[1]. As a young wannabe, it was very empowering for me to realize that all I had to do to accomplish my dreams was to open up Notepad and type some special text.
[1]: And images and videos and so on. That's not the point.
It should be demoted from "View Source" though; how the DOM got into its current state is not that important; only the current state really matters.
ADD: Jeez, don’t get me wrong, I’m not really trying to hide my code from anyone, I actually love writing open source software, it was just a fun idea to do this experiment :)
Your JS code may happen to be ASCII only, but in the context of ECMAScript, a character is actually a Unicode code unit.
function foo() {
/* ...characters for image data... /
bar();
/ ...more image data... */
The asterisks are not showing up but you get the idea. It checks out with the comments part of the javascript spec as well:
http://ecma-international.org/ecma-262/5.1/#sec-7.4
...as the text inside the comment can be any unicode code unit except for an asterisk (For source Character rules see http://ecma-international.org/ecma-262/5.1/#sec-6).
If you want to do something *f*a*n*c*y* put two spaces
at the front of the line, it will show up verbatim
including line breaks.