No View Source Code

Posted on 1999-11-28
Medium Priority
Last Modified: 2012-05-04
I would like to stop people visiting my web page from clicking on View source code in their browser. I beleive there is some Java for this, Can anyone help?
Question by:Soccerdreams

Accepted Solution

messentary earned 400 total points
ID: 2238933
There is no way of disabling it from Edit-->View source.  However, there is a way to stop it from the right click:

Place this between the <head> tags:
<script language="JavaScript">

// No rightclick script v.2.5
// (c) 1998 barts1000
// barts1000@aol.com
// Don't delete this header!

var message="Place your message here"; // Message for the alert box

// Don't edit below!
function click(e) {
if (document.all) {
if (event.button == 2) {
return false;
if (document.layers) {
if (e.which == 3) {
return false;
if (document.layers) {
// -->


Now if you want to make it harder.  Make a frames page with one frame 2 pixels (For Netscapes sake), and the second frame, your site.  When they view the source through edit, they will only get the frame source.


Expert Comment

ID: 6829419
This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  If you are an EE Pro user, you can also choose Power Search to find all your open questions.

This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.

Thank you,
Moderator @ Experts Exchange

Featured Post

2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
Now many of you may wonder how you can reach great design with least number of essentials. Isn’t stuffing ‘more and more number of elements that speak for the purpose’ the right way to do it? Erm, not always, and in this write-up, you will see why.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Suggested Courses
Course of the Month6 days, 6 hours left to enroll

588 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question