Good Day!

I just want to ask on how to hide the html codes of a certain page so that when my client view the source, they cant see it..


Thnak you!

Recommended Answers

All 9 Replies

Not going to happen. If the browser can't see the mark up then the page does not get rendered. Why would you care about hiding your mark up anyways?

you will need to use php, or another scripting language
for example

<div id="private">
<?PHP
/*
?>
Here is the secret html!!
<?PHP
*/
?>
</div>

the /* */ comment tags in php will stop the server outputting the code to the browser

if your page is in .html format
you will need to change to a php
then add a .htaccess file:

RewriteEngine on
RewriteRule ^myfile\.html$ /myfile.php [L]

the .htaccess file redirects the url to the new page, so all links to your site will still work

Hope this helps!!

That is not a solution if you actually want the browser to show the content. Like I said there is not a way to keep someone from seeing the mark up of an element on a page if it is being shown in a browser.

If you want the code to execute and not be visible, I would suggest using a compiled Language Such as flash/actionscript, Otherwise You may simply encrypt all the code using complex javascript so it is very difficult to read, However this can create some cross-browser compatibility issues

thank you for the nice reply.Ive seen some sites encrypt there source code instead of hiding it. But maybe its hard to achieve it...If you have any idea pls continue posting on this topic..

Thank you!

Not possible. If the browser can't see it, then it can't process it. You can try to confuse your users by using ugly coding techniques, but anybody armed with FireFox and FireBug will see every element on your site.

Always remember the golden rule. If you don't want it public, don't put it online.

how about html and script encryption? Is it possible?

Nope. You can't hide anything from the user if you want to show it to the browser. If the browser can see it, the user can see it. You can code PHP which is hidden from the browser, but users can see everything HTML, CSS and JavaScript.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.