We help IT Professionals succeed at work.

view source

cycledude asked
Hi Experts

Does anyone know of a way to completely stop someone viewing the source of your website?

I only want this when previewing  a site to a client, in case they run off with the site without paying!

Been looking online, and I know you can disable right click, but what about the view source menu item?


Watch Question

check these links

In short, it is not possible since the user has the response, and he can anyways save the files on his system to see the response,

One workaround for this is to show only the wireframes or different screenshots at the user events

Shinesh PremrajanEngineering Manager

there is some trick using the javascript & iframe which will make the code completely disappear for the end user. However smart developers can still peak into that,For naive users this will be just a JavaScript page.

Hope this helps

go through it:


This will give an idea.


Hmm thanks guys, I am getting the feeling this is not going to happen!

That fellgal.com website was telling us to convert sites into pdf format! Is he for real!

I will leave this open a while longer to see if anyone pick anything up.....

- Share only screenshots / convert pages to image, whatever.  
- Develop a page displayer in flash/silverlight
- Show everything on your machine :)
Top Expert 2010
You can encocode the HTML and render it through a JavaScript
There are some programs that would scramble the HTML source and make it unreadable or editable, but advanced users or programmers can decode them, it also doesn't work very well in all cases, especially when you have a complex structure and JavaScripts on the page.

However you can give it a try here http://www.auditmypc.com/html-encoder.asp
This is a simple free HTML encoder that would encode your HTML into something like below,

<script type="text/javascript">document.write('\u003C\u0021\u0044\u004F\u0043\u0054\u0059\u0050\u0045\u0020\u0068\u0074\u006D\u006C\u0020\u0050\u0055\u0042\u004C\u0049\u0043\u0020\u0022\u002D\u002F\u002F\u0057\u0033\u0043\u002F\u002F\u0044\u0054\u0044\u0020\u0058\u0048\u0054\u004D\u004C\u0020\u0031\u002E\u0030\u0020\u0054\u0072\u0061\u006E\u0073\u0069\u0074\u0069\u006F\u006E\u0061\u006C\u002F\u002F\u0045\u004E\u0022\u0020\u0022\u0068\u0074\u0074\u0070\u003A\u002F\u002F\u0077\u0077\u0077\u002E\u0077\u0033\u002E\u006F\u0072\u0067\u002F\u0054\u0052\u002F\u0078\u0068\u0074\u006D\u006C\u0031\u002F\u0044\u0054\u0044\u002F\u0078\u0068\u0074\u006D\u006C\u0031\u002D\u0074\u0072\u0061\u006E\u0073\u0069\u0074\u0069\u006F\u006E\u0061\u006C\u002E\u0064\u0074\u0064\u0022\u003E\u000D\u003C\u0068\u0074\u006D\u006C\u0020\u0078\u006D\u006C\u006E\u0073\u003D\u0022\u0068\u0074\u0074\u0070\u003A\u002F\u002F\u0077\u0077\u0077\u002E\u0077\u0033\u002E\u006F\u0072\u0067\u002F\u0031\u0039\u0039\u0039\u002F\u0078\u0068\u0074\u006D\u006C\u0022\u003E\u000D\u003C\u0068\u0065\u0061\u0064\u003E\u000D\u0020\u0020\u0020\u0020\u003C\u006D\u0065\u0074\u0061\u0020\u0068\u0074\u0074\u0070\u002D\u0065\u0071\u0075\u0069\u0076\u003D\u0022\u0043\u006F\u006E\u0074\u0065\u006E\u0074\u002D\u0054\u0079\u0070\u0065\u0022\u0020\u0063\u006F\u006E\u0074\u0065\u006E\u0074\u003D\u0022\u0074\u0065\u0078\u0074\u002F\u0068\u0074\u006D\u006C\u003B\u0020\u0063\u0068\u0061\u0072\u0073\u0065\u0074\u003D\u0069\u0073\u006F\u002D\u0038\u0038\u0035\u0039\u002D\u0031\u0022\u0020\u002F\u003E\u000D\u0020\u0020\u0020\u0020\u003C\u0074\u0069\u0074\u006C\u0065\u003E\u0045\u006E\u0063\u006F\u0064\u0065\u0064\u0020\u0054\u0065\u0073\u0074\u003C\u002F\u0074\u0069\u0074\u006C\u0065\u003E\u000D\u003C\u002F\u0068\u0065\u0061\u0064\u003E\u000D\u003C\u0062\u006F\u0064\u0079\u003E\u000D\u0020\u0020\u0020\u0020\u003C\u0064\u0069\u0076\u0020\u0069\u0064\u003D\u0022\u0077\u0072\u0061\u0070\u0070\u0065\u0072\u0022\u003E\u000D\u0048\u0054\u004D\u004C\u0020\u0045\u004E\u0043\u004F\u0044\u0045\u0020\u0054\u0045\u0053\u0054\u000D\u003C\u0062\u0072\u0020\u002F\u003E\u000D\u004C\u006F\u0072\u0065\u006D\u0020\u0049\u0070\u0073\u0075\u006D\u0020\u0044\u006F\u006C\u006F\u0072\u0020\u0053\u0065\u0074\u0020\u0041\u006D\u0065\u0074\u0020\u002E\u002E\u002E\u002E\u002E\u000D\u0020\u0020\u0020\u0020\u003C\u002F\u0064\u0069\u0076\u003E\u000D\u003C\u002F\u0062\u006F\u0064\u0079\u003E\u000D\u003C\u002F\u0068\u0074\u006D\u006C\u003E\u000D');</script>

Open in new window

The only totally foolproof way is to use a screen capture utility, like MWSnap, and capture a JPG image of the test site, then put that up for the clients to view for approval, or even send them the JPG via email.  If you make it hi-res, they can pour over the details, and say, OK go ahead -- and they can't see the source.

Once the HTML is rendered into a browser, even if using javascript to build the HTML dynamically, that code can be stolen by anyone -- since it is now in their browser, they can save it and RE the code.


Hi Experts

Thanks for the responses...

I guess there is no real solution to this then.... The problem for me is that I do quite a lot of PSD conversions for designers, and in order for them to see the site converted it really needs to be in html format, I don't think they would appreciate me showing them a jpg of their PSD!

Thanks again



Conclusion: There is no way to prevent a user seeing the source to a webpage, we can just make it more difficult for them to do so, or use pdfs! (NOT!)

Your conclusion is what I said.  If you had mentioned PSD files I could have recommended other ways.


I don't see how there's any relevance to your point of PSD's.... I need to display the end product as a html website, so the source has no relevance in this.
But thanks for the comments.