How to block view source

Hi All !
How to block view source in a web page ?
I do not want to block right click .
How to Block Back button ?
And How to block Save Option of a web Page.

I serached google but did not have exact code.
Please help me.

<html><head><meta http-equiv=“Content-Type” content=“text/html; charset=iso-8859-1”>
<title>sample page</title>
<body viewsource=“no”>
<h1>sample page</h1>
<p>some text</p>


actually, i was just kidding – the only way that is guaranteed to prevent people from viewing your source code is: don’t put your page on the internet!!

At least tell me how to encode the source (It is possible).
And also
How to Block Back button ?
And How to block Save Option of a web Page.

I don’t believe there is a way to encode the source, other than one or two ways that a small number of browsers support. If you have a look at the MSDN site they’ve managed to assign the ‘back’ button to redraw the page you’re on, and it’s really annoying, IMO this should be avoided at all costs, but if you really need to there’s plenty of information available via Google or wherever.

As for blocking the save button, again I can’t think that there would be a way to do this that works on all browsers.

Can I ask why you particularly want to go to these lengths? For example, it’s a very small bit of code that could just call your web server and retrieve your page into a file on a local PC, so even if you managed to find code to disable “save” on all browsers, someone who wanted to save the page could still do so.

watch the above link. Here the source code is encrypted.

This page :
And the above page are almost same.
But one’s view source is encrypted and the other is normal

it is very poorly encrypted, very easy to read the source:

<title>How to block source code viewing Encrypted Do Not Open From Index</title>

<!-- Start of  no right click script -->

<script language="JavaScript">

// No rightclick script.
// Find more great scripts and applets at the JavaFile!
// Do not delete this header!

var message="Sorry, Right Click Disabled  Copyright © 2001-2002, Consigliere Ltd., All Rights Reserved"; // Put your message for the alert box between the quotes.

// Don't edit below!

function click(e) {
if (document.all) {
if (event.button == 2) {
return false;

et cetera 

Use a windows forms application.

You can’t plain and simple! Why would you want to? The openess of the internet is one of the main reasons for it’s continued success.

If you REALLY wanted to do this you could do it with flash but that brings loads more problems with accessibility and such.

That’s not encrypted, it’s just encoded in a URL-safe method, just like when you pass variables that contain spaces as part of a URL - you can still see most of the keywords. It will put off the casual reader, sure, but again a short bit of code will turn that back into readable HTML page source.

It’s similar to a technique someone recently pointed me to where email addresses are specified in this form so that bots can’t quite so easily trawl your site for spam lists.

If what you intend to put on the site is so important that you have to take these steps, then you might want to look at protecting it behind some kind of login requirement.

I’m curious as to why you would want to hide HTML source…

I like the encrypted page from the angelfire site. Typical coder monkey claim by someone who does not know the difference between encoding and encrypting. And the laugh is, yes, you cannot easily read the source, however; if you have a webpage I’d really be interested in knowing the source for, umm, I’d just hash together a perl script of some sort and, then wellnow. :rolleyes:

And if I wasn’t that technically proficient, I’d just open it up in Textpad, grab a ascii hex chart and universal search and replace these well known encoded characters, until I had a pretty good idea of what is going on which would take only about 5 minutes. :rofl:

And Coder Monkey PEBKAC legal statement. How do you get the IP address from me when I’m viewing source from my browser cache? Oh, wait, you know that everyone who has performed an http get on your page to view it and generated a log entry is stealing your code! :smiley:

<!— We have recorded your ISP address and will take legal action
if you continue to view the source code on this page!
Security, Legal and Copyright Infringement Dept.
Consigliere™ Ltd. —>

followed by 2 screens of crlf to hide it for someone who cannot use the scroll bar. :goof:

that’s exactly what i did (see post #6), except i used Ultraedit


r937, I like your <body viewsource=“no”>, that’s like sending the new kid on the flightline down to the shop to get a bucket of propwash (airplane mechanic’s joke, how do you fill a bucket with wind?).

Oh, and another thought, javascript encoding your web page should be really good for your SEO technique, I think everyone out there that’s my competitor shoud really go out there and adopt encrypted/encoded html right now! Do it, it will get you on the first page of every search engine’s results page! (Nelson’s Ha, Haaaa! here)

I want to encode or block view source because sometimes I do not want to show
the values kept in the hidden fields.

And I have noticed that in some sites the save option is blocked.Immediately I can’t remember the name of a site like that category but if I find I will post the link of the site.
Actually what I noticed : when I wanted to save the page, save started but not completed and nothing was saved in the folder where I tried to save that page.It happened once and again. But the other sites did not create any problem while saving.

How to block copy paste in a text box.
I don’t want to block Right Click.
I want to block
Ctrl+c and Ctrl+v
copy paste option with Rigt Click.

How to block view source in a web page ?
I do not want to block right click .
If view source block is not possible, then how to encode it as if one
opens view source,the one will see the encoded data.

How to Block Back button ?
And How to block Save Option of a web Page.

I serached google but did not have exact code.
Please help me.

If you’re trying to hide the values in hidden fields so that you can post them back to another CGI that’s in your control, you’d be better off with a different technique, such as storing them in a session file on the server and putting a reference to that in your hidden variables. If it’s not in your control, you’re going to have a problem because the vars will have to be in the format that the CGI expects, not some encoded or encrypted format.

I don’t think you’re going to find a solution to this, even in the other threads - whatever you might find working in IE probably won’t work in Firefox, or maybe Opera, or Netfront, or Safari, or whatever else the customer uses. You should find a different way for it to not matter IMO.

Don’t bother. You can make it a bit more difficult for absolute newbies, but there is no way to prevent people from seeing the markup. The browser must see it to render the page, and if the browser can see it, so can people.

If you don’t want people to see the content, don’t put it on the Web.

Don’t bother. You can’t do this. Putting a transparent image on top of the page may slow some n00bs down, but that’s all.

If you don’t want people to access your content, don’t put it on the Web.