Blocking View Source - Yet Again
Question: I was searching for an answer to teh question "How do I disable the view source option on a browser's menu" and I came across your answer.
I have to disagree with your answer to the question about disabling the view source menu option. First of all, the goal in not to stopping users from viewing source code, it is to disable the menu option from displaying it.
So far I have seen a method that disables the browser's hot keys and am just curious if that is it. You went to such effort to avoid answering the question and did it so well that I figured asking you to actually answer the question would not be too forward.
anonymous
Answer: what we are discussing here then is "How to be really obnoxious and drive visitors away from your site". The simplest way to do that is to simply delete your site so that no one can visit it at all.
You need to distinguish between YOUR web page and your VISITOR's browser.
- You can control the content of your web page and make suggestions via CSS and Javascript as to how it should display and interact.
- Your visitors decide how they want their browser to function and what permission (if any) that they will give web pages to change their browser.
- You can't change anything in the menus/toolbars of an existing browser window in most browsers. The Mozilla/Firefox/Netscape browsers allow signed Javascripts to remove menu and toolbars provided that the browser's owner gives permission. Beyond that you can only control what appears in new windows opened via Javascript and then need to get your visitor to click a link to open it. Any CSS and Javascripts defined by your visitors are applied after any that you supply with the page.
- The goal in removing options from the menu may not be to remove their ability to use that function but where such removal is possible you can only do it where that visitor gives permission to do so and most prefer that web pages leave their browser alone and so you end up with something that only works where your visitor doesn't understand their bnrowser well enough to block you.
Any interference with browser operation just annoys your visitors and drives them away so as I said before, if that is what you really want then the simplest way to achieve your goal is to delete your site.
Removing the menu options for viewing the page source (even if your visitor allows you to do it) does not stop them from accessing the source through other means. Neither does encrypting your source since the browser has to decrypt it in order to display it and your visitors have access to that decrypted copy with your having no way what so ever to block that access.


