How to make the HTML page view source UNREADABLE?

11,625

You can't. You can obfuscate the scripting and minify the html (remove all unnecesary whitespace) that's what google does). So, making the readability of the html (by obfuscation, minification) more difficult is the best option (if you must).

You can also go flash ofcourse, like in this website

Share:
11,625
Santosh
Author by

Santosh

Updated on June 04, 2022

Comments

  • Santosh
    Santosh almost 2 years

    We have an option of disabling the right click event on the HTML page at same user can click on view menu > source and can get a copy of the content displayed. How do i make it into unreadable format? Just like when you do a google search and see the source of page very similar to it? How can this be done?

  • DA.
    DA. almost 12 years
    it's a pointless option, though. Anyone that wants it, can get it.
  • KooiInc
    KooiInc almost 12 years
    That's why the first line of my answer states: you can't.
  • karan k
    karan k almost 12 years
    +1..he already mentioned that it isn't possible. All you can do is use an obfuscator to make it hard to read
  • DA.
    DA. almost 12 years
    I agree. But I wouldn't call obfuscation a 'best option' as it's trivial to get around that.
  • DA.
    DA. almost 12 years
    (In other words, it's a fine answer, except for the last sentence)
  • DA.
    DA. almost 12 years
    @Sammy...but it doesn't make it unreadable. Just open Firebug. It's all nicely formatted there for you.
  • Santosh
    Santosh almost 12 years
    Ok! people i got your views, but requirement is to make it completely unreadable whenever user try to access the source of page. So, what the best tool/script/procedure to be used for this?
  • DA.
    DA. almost 12 years
    @Santa_612 as stated. You can't do that. For a web page to work, the source has to be downloaded to a person's machine. Once there, any number of tools can read it.
  • Sammy S.
    Sammy S. almost 12 years
    @DA. I know. That's why I put "unreadable" in scare quotes :). It just becomes less "readable" if you strip unnecessary newlines and whitespaces. Ever tried to read a minified JavaScript? :)
  • Sammy S.
    Sammy S. almost 12 years
    @Santa_612 You could use JavaScript to generate all the HTML code so people without a DOM debugger such as Firebug can't see the actual code. But it's impossible to completely hide you HTML.
  • DA.
    DA. almost 12 years
    I guess my point was that, at least with CSS and HTML, things like Firebug are basically one-click away from making it all completely readable again. Minified JS takes an extra click or two (namely copying and pasting it into a JS formatter tool). I agree that the native source files are a tad harder to read, but it's so insanely trivial to bypass the native formatting that I hesitate to even suggest that as an option to people that ask this type of question as they may not realize how pointless it really is.
  • Sammy S.
    Sammy S. almost 12 years
    @DA I completely agree. The problem is not the question itself but the idea behind it. Security by obscurity just doesn't work for web pages (and for other stuff - most likely - not at all).
  • Santosh
    Santosh almost 12 years
    @DA/Sammy I completely agree with you people. Its impossible to completely hide the HTML. My requirement is to make it look like minified format. Am not worried about using external debugging tool to make it readable. What is needed is to make unreadable on the 1st go.
  • DA.
    DA. almost 12 years
    @Santa_612 sometimes requirements are wrong or just plain illogical. This is one of those cases. (FYI, even with non-external debugging tools...like Chrome or Safari, you can see the nicely formatted markup). That said, if you simply want to minify things, then there are plenty of options. Google 'JS/CSS Minifier' for various options.