General discussion


Prevent View Source Code

By Shanghai Sam ·
I would like to know if there is a JavaScript code that stops the source code from being viewed completely. I don't mean any of those disable right click codes either.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

Prevent View Source Code

by Shanghai Sam In reply to Prevent View Source Code

There is no script to hide the source code. But there are some javascripts that will encrypt it. Problem with these codes is that you need to un-encrypt first to edit it.
Try this url for more help. or

Collapse -

Prevent View Source Code

by mtadeu In reply to Prevent View Source Code

If you don't want your code to be seen in a web page, make an activex control! use it in your html, vbscript, javascript or watever is the language you want to use.If you understand COM/ActiveX programming, this shouldn't be a problem!

Good luck,
Miguel Tadeu

Collapse -

Prevent View Source Code

by Marty R. Milette In reply to Prevent View Source Code

Yes, unless you use some form of encryption, there's nothing you can do to stop anyone from viewing the HTML. Anyone can 'telnet' directly to the web server, or use an application they can create in VB in about 2 minutes to see the source coming directly from the server.

The JavaScript encryption solution will work, but can also be reverse-engineered easily. Only valuable to prevent the 'casual' thief. Also, if JavaScript is disabled (as it more and more often is to avoid pop-ups), then clients can't view the page.

Same with ActiveX controls and Java Applets. More and more people are disabling them because of the security risks. Corporate networks are getting very tight.

If your audience is a 'known' entity (intranet), company, etc. with standard browsers/configuration, and/or you could become a 'trusted site', then you may have more options.

Related Discussions

Related Forums