How to prevent View Source of page using Javascript?

how to disable view page source in php
how to hide source code from public view
hide html source code using php
how to hide javascript code from view source
how to hide password in view page source
hide html source code using javascript
how to encrypt html source code using javascript
disable right click javascript

How to prevent to download the source code of page using File > Save as?


You can't. The page is effectively already being downloaded when you view it in the browser. If you want to protect the contents, you might be able to obfuscate the source, and depending on what you are doing you might be able to make the page non-functional once it has been downloaded (ie making some behavior of the page rely on an Ajax request to your server). But there will always be workarounds.

How to hide html source & disable right click and text copy?, It's a basic tenet of web design that in order for a page to be displayed, the Why do some websites have one solid block of code when you view source views. If by source code you mean HTML, CSS or JavaScript, then you can't hide them. This code to disable ctrl (control).once you disable the ctrl other all event such as ctrl+C,ctrl+A etc. are disable. <script language='javascript'> //function for to disable ctrl event of the page. function document.onkeydown() { if


How to hide the source code of a website, js package away. The following steps introduce a commonly used JavaScript obfuscator, and also look at a few other topics related to the problem  The page is effectively already being downloaded when you view it in the browser. If you want to protect the contents, you might be able to obfuscate the source, and depending on what you are doing you might be able to make the page non-functional once it has been downloaded (ie making some behavior of the page rely on an Ajax request to your server).


You cannot prevent this behavior. Even if you were to be able to prevent it in any particular browser, you are still delivering code content that browsers render for you, someone could just create a raw request and view the source.

How to stop somebody from viewing the source code of the , These scripts stop users from right-clicking, where the "View Source" function is located. Someone who understands JavaScript can easily decrypt the page. Excellent workaround. One more replacement is needed, for ampersands, so escaped entities are rendered in source. IIRC (and this is a vague recollection), some browsers may not give you exactly the same source with innerHTML (losing original white space, altering some capitalization of elements/attributes, etc.), but it's close enough for most purposes. – richardtallent Nov 30 '09 at 0:39


As a more constructive answer, if you're talking about stopping people downloading your javascript file, you can't, however you try obfuscating/confusing/packing the script text into something pretty much unreadable.

Try this javascript obfuscator. It seems to work pretty well!

As a note, this won't stop someone who is determined, but will certainly really slow them down.

How to hide your JavaScript code from View Source, If there was, I could always save the page to my site and view it. …is there any way one can prevent the source of their website from being viewed? two lines of JavaScript and a web browser to recover the decrypted version of the page. It's not possible to disable viewing a pages source. You can attempt to circumvent unknowledgeable users from seeing the source, but it won't stop anyone who understands how to use menu's or shortcut keys. Your best bet is to develop your site in a manner that will not be compromised by someone seeing your source.


<!-- Right Click Disable -->
<script type="text/javascript">
<!-- 
var message=""; 
function clickIE() {if (document.all) {(message);return false;}} 
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) { 
if (e.which==2||e.which==3) {(message);return false;}}} 
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;} 
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;} 

document.oncontextmenu=new Function("return false") 
</script>
<!-- Right Click Disable -->

Web Developer Class: How to Hide your Source Code, Obfuscate/minify your JavaScript code so that it becomes practically unreadable. you can simply right click > view source and then if your using a browser CTRL+U is the hotkey for viewing the source code of a web page. Also, there are keyboard shortcuts like Ctrl+U that can be used to view source. All this method does is add about a two second delay to someone trying to view your source and it does irritate users who aren't trying to view your source. "JavaScript Encryption" This is by far the most popular way to try to hide one's source code.


Hide view source? - HTML & CSS, That shortcut is handled by the operating system. It never reaches the browser and so the browser has no opportunity to pass it to the web page  How to disable the view source ? I would like to deploy an application page, but would like to disable the View Source feature so that the code will not be displayed. If possible, Can you prvide sample code ?


Hide Your jQuery Source Code, Hi, When I view 'page source' of my hosted website, all my code is displayed. How do I hide this code from others viewing it? <script language="javascript"> document.onmousedown = disableclick; status = "Right Click  If you want to View source code of web page using Javascript then here is a simple example just copy and paste the script below to your webpage and press the View Source button. <form action="#" onsubmit="return getsource();"> <input type="submit" value="View Source!"


javascript - How to Disable (View Source) and (Ctrl+C , how to prevent page refresh using javascript? along with any associated source code and files, Pages using javascript to prevent making it in iframe.