Skip to content Skip to sidebar Skip to footer

How To Remove Hidden Divs From View Source Of A Page?

I have a HTML Page, in which there are some hidden DIVs and these DIVs are visible vai view source of a page. These DIVs should not be visible to a user when they 'view source' of

Solution 1:

You can't really prevent a div from being read, because if you do, there will be no render of it.

It can be encrypted and generated via javascript. But once it is generated, user will be able to see it clearly in computed source.

Solution 2:

There is no way of doing what you want. The source (in case of HTML) is just text containing HTML markup. The show source view in the browser shows it to you as it came from the server with added syntax highlighting, but unlike the developer tools, it doesn't reflect any DOM changes done with Javascript. Even if some browser had a feature to prevent some parts of the source from being displayed, users will still be able to open it in another browser or download the HTML as a file and examine the source in a text editor.

Solution 3:

JavaScript will only change the "computed source" so the client will still be able to see them. In order to really remove them you'll need to remove them server side.

Solution 4:

You can not really hide the source code but you can encrypt it. What you transmit from Server to the Client will be in the client side browser and can be seen somehow.

With a tool like the one I just googled http://www.iwebtool.com/html_encrypter it is possible to encrypt html.

It will encrypt your html code and you can insert it via javascript later. Encryption will not finally hide it from someone keen in using debugging tools. But a "normal" user won't see it directly in the source.

Still you should be thinking about storing information you want to hide from the user server-side in a session or something.

Post a Comment for "How To Remove Hidden Divs From View Source Of A Page?"