Can I hide html source?

Can I hide page source on my website without disabling right click and just show a message which replaces html source like the following website?

In a word, no.

If you scroll down the source of that page, the html is there after a load of white-space.



                  No. :unhappy: :rolleyes:




No you can’t hide the page source of one’s website.If you block Right click,F12,There are ways or tools to restore this. One thing you can do is obfuscated the code so that it difficult for the humans to understand.

I have seen phishing sites do this. The source is just a piece of javascript with a long encoded string that is not readable, a link to a script that decodes it, then a document.write at the end.
So of course, it does get decoded and does get written to the document and can be viewed and/or copied via “Inspect” in any browser.

The bottom line is: For your browser to show a web page, the code for that page must be presented one way or another at the client side. If there is nothing there, there is nothing for the browser to display.

The only sure way to hide your html code is to not publish it on the internet.


Perhaps if you could explain why you want to do this, @sintex150, we might be of more assistance. It seems an odd thing to be worrying about.


Hi there hnymatc,

I do understand that you you have only recently joined
these august forums, but when posting replies you really
should ensure that your remarks are directed correctly.

You have assumed in your post - ( #4 ) - that it was I who
wanted to hide his source code, when, of course it was the
O.P. @sintex150 who had this ridiculously impossible dream. :rolleyes:


1 Like

Off Topic

This is one of the vagaries of Discourse which has caught out very many members at one time or another.

If I quote from your post, it is correctly attributed. If I quote quoted text from your post, it is attributed to you, even though the original is correctly attributed in your post.

I was aware of that anomaly. :winky:

But there was still no reason for @hnymatc to be quoting my
post in the first place, unless he/she was refuting my assertion


Originally HTML was more of a word-processing format; until recently HTML was an “application” of SGML, a word-processing standard. (SGML was derived from IBM’s GML, a set of macros for a word processing system).

Perhaps you are actually asking about the JavaScript programming. There are a couple of reasons why that cannot be hidden, the main reason is because the HTML cannot be hidden. The other reason is that JavaScript is a translated language; execution requires the source code and since the browser must see the source code, everyone else can too.

That is the advantage of server-side programming; C# and PHP source code is generally not visible to the world. If you want to hide your client-side code then Java can hide it much better than JavaScript can. With Java only the bytecode is downloded, not the source code.

No. They are referring to hiding the actual HTML source code from the Page Source feature. They probably just looked at the top part of the HTML source code when viewing it. All they saw was a huge line break gap and assumed it’s possible.

But like everyone else said. Simple answer No.

I will wait for sintex150 to say that.

The OP states it.

1 Like

See the title:-

Can I hide html source?


You can hide some, by using AJAX.

You mean this bit, which says “No viewable source”?


The only way that you could hide “Source Code” from
@TechnoBear’s eyes, would be to poke them out. :rolleyes:



Never poke the bear…


Note that I qualified my response. Using the “view page source” menu after you right-click the page. I also mentioned that “Inspect” will also show it.

Would not think of it. :slight_smile:

1 Like