Live data from Hacker News

A technique for hiding your JavaScript code

patrick-wied.at

31–36 of 36 posts

Re: A technique for hiding your JavaScript code

#31
post #8

I can't help but feel saddened that we learned how to code using View Source (indeed, it's a big factor in the web's success) and now we're trying to prevent others doing the same. 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."

"Developer tools" is the new View Source. Browsers should really just redirect View Source to the live DOM view of their developer tools, that's what most people want from it.

Developer Tools would've scared the crap out've me when I was 11 years old trying to figure out how web pages worked.

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.

Re: A technique for hiding your JavaScript code

#32
post #19

If someone is clever enough to hide their JavaScript like this, then they hopefully know that it isn't foolproof. In other words, don't rely on obfuscating your code for anything related to security (as an example).

Did you read to the bottom? He knows it doesn't really hide the code. He's just having fun and slowing down the lowest level of code-stealers.

Actually, this slows down all levels of code stealers. No longer can we simply copy and paste (or download if it is its of *.js file) into our editor of choice. Now, we have to open the dev console, call getCode(), and deal with any formatting issues that might arise (such as \\n -> \n).

Re: A technique for hiding your JavaScript code

#33
post #8

I can't help but feel saddened that we learned how to code using View Source (indeed, it's a big factor in the web's success) and now we're trying to prevent others doing the same. 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."

"Developer tools" is the new View Source. Browsers should really just redirect View Source to the live DOM view of their developer tools, that's what most people want from it.

They do very different things. View source will show the document as delivered to the browser; developer tools show the page as rendered. You really need both.

Re: A technique for hiding your JavaScript code

#34

Earlier quoted context omitted.

"Developer tools" is the new View Source. Browsers should really just redirect View Source to the live DOM view of their developer tools, that's what most people want from it.

They do very different things. View source will show the document as delivered to the browser; developer tools show the page as rendered. You really need both.

The former already exists in your browser's Network panel of the developer tools. It's the response for /Foo from the server.

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.

Post reply on HN