Hi ,
Can anyone suggest me the code for to stop viewing the source code(No Right Click/Stop People From Viewing Source Code ) for any type of browsers developed in any technology.
Hello Buddy...
I Don't wanna hide anything from the world but just wanna know that the code for it...if itz possible plz let me know orelse thanks for the reply to my post...
As the others have said above, it is impossible to hide the HTML from users. You can do some things in JavaScript to make it a little complicated for them to see your code, but eventually you have to give the browser access to the real code so it can render the page. And anything a browser can decipher, a user can too.
Don't waste any time or effort on this. It's not worth it.
When you will implement that in your site, let me know the url, so that I will enter your site, copy all your codes and I will send them back to you by e-mail.
Hi. Every web-browser downloads the complete source of your page, and regardless of whether you disable right click or not, the user can save a copy of this code, or view the source from the menus in any mainstream browser, no plugins or special knowledge required.
Even if browsers didn't allow this, a novice programmer could write a program in less than 3 lines of code to download and save the source of your page, all they have to know is the address.
If you want you could try making the code hard to understand. There are minifiers and obfuscaters for javascript (which shrink your code or make it hard to read).
You can also put most of the program logic on the server side so that people can read the output you send them (ie the pages), but not how your web application works (ie how decisions are made and page content is generated).
What is your purpose in trying to hide your code? If you explain that then maybe there are other ways to achieve what you want.
Agree with "Interfacetricks" there is no way to hide the code. With right click disable only beginners or someone who doesn't have much knowledge can be kept away from the code and if someone knows a bit about the code they will also know that in case right click is disabled they can go to File..>Save as menu and save the code locally then view the code. Then there are many applications that can save the complete site with all the css and images.
Client side code cannot be hidden.
var message="Function Disabled!";
function clickIE4(){ if (event.button==2){ alert(message); return false; } }
function clickNS4(e){ if (document.layers||document.getElementById&&!document.all)
{ if (e.which==2||e.which==3){ alert(message); return false; } } }
if (document.layers){ document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4; } else if (document.all&&!document.getElementById)
{ document.onmousedown=clickIE4; }
document.oncontextmenu=new Function("alert(message);return false")
Interfacetricks is right, the only way to hide your logic is to put it server-side using PHP or such like. But if your site is simple HTML/CSS there is no way to hide it. The browser has to be able to read the client-side code, so a user can as well. Using scripts to disable functions just pisses off the users. Forget it!
Bookmarks