Disable source viewing option?

How can "view source" option for a HTML document be disabled?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You can't.

The best you can do is open a new browser with no menu bar.

But that will only work with inexperienced web users.

Anyone can view the source of a page sent over the web.

If you send it, it's viewable.
Yep, like mayhew says,

because html pages are client sided they can be viewed all over the world, though you can adapt some tricks, but nothing can totally prevent viewing your source.

Some tricks :
-disabling right click
-opening window without menubar like mayhew says
-encrypt your code

Though like I said it's not fully protective.

Encrypt your code with any of the utilities around. Here you'll have one of the best:


It's not a 100% secure method and only works with javascript enabled browsers.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Nathan Stanford SrSenior ProgrammerCommented:
Maybe our question to you should be what are you trying to hide?

actually every kind of source can be put in iclude files making them unviewable...but there's always gonna be a smartass that will be able to view it!
See the question ablut two down from yours titled:

disabling html code to browsers

There is no way to 100% hide the source code because the browser has to "see" the code in order to render it.  that means there is a copy of the page on the client machine to play with that can eventually lead to the code.
If you want to hide some tricks, you've made code it in java. there's no way to see code.
Actually a good way to prevent anyone from stealing your hard work html is to do it in Flash. The Html Page reads from a .swf Page and noone can see your work even if they really wanted to, not even if you are an experienced Web User.
Not even SWF files are safe from people wanting to get into the source. I have seen utilities on the Internet that allow you to unlock and open SWF files into their native FLA format. Sorry to burst your bubble cepedare.
The best you all can do is do your homepage in Flash. all your work and images are safe and nobody can steal them. For you all that don't know what flash is just do a quick search.
Cepedare, read my comment just before yours. If you publish stuff on the Internet - it's not safe. Period.
oh sorry for missing your comment CyberSoft. I wasn't aware of those utilities. But all I am trying to say is that by doing it in flash is more safer than html. Do you agree?
Yes, I do agree that Flash files are safer than HTML. But the point remains that anything you publish on the Internet is open-source. If you want to prevent someone from (well not physically but legally) you need to apply for local and international copyrights for whatever it is you are publishing on the Internet.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.