General discussion

Locked

Protecting or hiding HTML code

By johnlcooke ·
Is there any way to protect or hide the HTML code behind a document, or any way to prevent the code being displayed by 'view source'?

This conversation is currently closed to new comments.

7 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Protecting or hiding HTML code

by 4U21DER In reply to Protecting or hiding HTML ...

There is no way to "protect" html source from being viewed. The best bet if you wish to hide code and or styles is to use a scripting language like ( ASP or PHP or CGI ). You can also include files that have links to a Style Sheet.

Hope this helps.


Good Luck!

Collapse -

Protecting or hiding HTML code

by johnlcooke In reply to Protecting or hiding HTML ...

Poster rated this answer

Collapse -

Protecting or hiding HTML code

by Ann777 In reply to Protecting or hiding HTML ...

The above answer is correct. There are ways to disable right-clicking or disabling the view function.... but there are "freeware" utilities on the market that will download html code of websites anyway. Don't bother trying.

Collapse -

Protecting or hiding HTML code

by johnlcooke In reply to Protecting or hiding HTML ...

Poster rated this answer

Collapse -

Protecting or hiding HTML code

by kschang In reply to Protecting or hiding HTML ...

Indeed, there is no way to "hide" the source code for HTML, since HTML is not a programming language. The browser does not translate the HTML in any way, it merely interprets the input and displays the content with the layout/format specified.

As a workaround, there are ways to obfuscate the code, and even semi-encrypt the code by using Javascript. However, it is easily decoded (indeed, it MUST be for the browser to display it!)

One trick you can do is remove all the carriage returns inthe HTML source code. It will be utterly unreadable in "view source" format unless the reader spends time adding them back.

You can find the Javascript "encryption" via search engines easily. You can also use Javascript to disable right-click, go into "kiosk" mode, and such, which would make viewing the source code more difficult, but it's not possible to completely disable the source code viewing.

Collapse -

Protecting or hiding HTML code

by johnlcooke In reply to Protecting or hiding HTML ...

Poster rated this answer

Collapse -

Protecting or hiding HTML code

by johnlcooke In reply to Protecting or hiding HTML ...

This question was closed by the author

Back to Web Development Forum
7 total posts (Page 1 of 1)  

Related Discussions

Related Forums