View Full Version : disable view source
future100
11-05-2005, 08:37 AM
How to disable the view source in the internet explorer using javascript
VortexCortex
11-05-2005, 08:50 AM
Hiding your HTML can't be done in any realistic way... the data is meant to be sent to the client, and eventually must appear in some readable format to the browser, so anyone with a bit of coding under their belt can view your source.
If you're that worried about your code being stolen, then Copyright it.
If you can't afford to copyright it just yet, then print it out, and snail mail it to yourself via certified mail. An un-opened post marked envelope containing the original code is pretty good evidence in any Copyright case.
ken_shoti
11-05-2005, 10:52 AM
if you really want to secure your code, download a software that would encrypt your code, even password protect it and all security measures.
Bill Posters
11-05-2005, 11:12 AM
Hiding your HTML can't be done in any realistic way... the data is meant to be sent to the client, and eventually must appear in some readable format to the browser, so anyone with a bit of coding under their belt can view your source.
If you're that worried about your code being stolen, then Copyright it.
If you can't afford to copyright it just yet, then print it out, and snail mail it to yourself via certified mail. An un-opened post marked envelope containing the original code is pretty good evidence in any Copyright case.
Copyrighting of original work is free and occurs by default.
Registering that copyright with a solicitor/notary/copyright office is where the costs come in, but that doesn't make the copyright any more legally binding. It's simply a measure to ensure the precedence of the work.
Additionally, it's by no means certain whether a website's code qualifies as copyrightable material as it may not show sufficient originality/individuality to establish it as an original work.
The site author can surely attempt to copyright it (and doubtless lawyers and copyright offices will surely take your money should you wish to try), but the validity of that copyright may well be successfully challenged should it ever become an issue for the courts.
I've not heard of one instance where a site's underlying code has been successfully copyrighted to any enforceable extent.
This is not to say that there definately haven't been any instances, just that I've not heard of any.
If there have been instances, then I'd be genuinely interested to know the details.
ImperialSpider
11-05-2005, 06:28 PM
The question that was asked was how do you disable the view source?, not how do I protect my code?
This type of question keeps getting asked over and over and over again, and will keep getting asked because no one answers the question... they keep putting words in the question that simply are not there.
Can someone PLEASE post the script that will disable the source option from the view menu in IE. That way when someone wants to ask this question for the 20 gazillionth time, they can simply be referred to this thread, and end all of the debates going on about how you can NOT hide your code from people who truely want it, OR from people who know what they are doing, and how all they have to do is blah blah blah... and they got your code. Who Cares?!? - NOBODY!!! Just give an answer to the question so we can all finally move on, not give excuses for the fact that you probably don't have the slightest clue of how to do this...
I admit it, I DO NOT know how disable the view source, or I would post it and stop the madness myself.
Sorry if it sounds like I am on my soapbox a little too long, but this is getting to be so absolutely rediculous that this question keeps getting asked over and over and never seems to get an answer.
PLEASE, someone post the code for this so we can all move on. Sheesh!
Thanks,
ImperialSpider
felgall
11-05-2005, 09:22 PM
There is NO WAY to disable the view source option in the Internet Explorer main menu bar that just uses Javascript since Javascript cannot access anything outside of the web page. There may be an ActiveX control that can do it but if you follow Microsoft's recommendations and disable ActiveX then that will not work.
fleshth
11-06-2005, 02:34 AM
It's poitless to try and "disable" any way. doing that, you are just going to piss people off and make them want to. like when i come across a site that has right click disabled, i have to do the whole javascript:alert(document.onmousedown =null) thing in the address bar and just think, "morons" it makes me want to do it. what you can do. i saw this at doubleyou.com, it's pretty clever. when you right-click it opens a dummy file in notepad (or default source editor),
window.location = "view-source:http://path-to-dummy-file"
but as forementioned, there is no way to disable "view source".
Philip M
11-06-2005, 07:39 AM
As Imperial Spider says, get on with it and answer the chap's question.
<SCRIPT>
function clickIE() {
if (document.all) {return false}
}
function clickNS(e) {
if (document.layers || (document.getElementById && !document.all)) {
if (e.which==2 || e.which==3) {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>
It has been said a zillion times: geeks can easily circumvent this, but 99.9% of people do not know a thing about JavaScript and do not remotely know how to overcome it.
felgall
11-06-2005, 08:12 PM
That code doesn't answer the question. It only disables the context menu in some web browsers. It doesn't disable anything in Opera and it diesn't disable the view source option in the main menu bar of any browser.
Also anyone wanting to steal your code will definitely know how to circumvent this simple code and most will know how to circumvent any encryption applied to the page as well. Only those people who wouldn't want to steal your page content will not know how to circumvent the script and many of them wont know how to work their browser with the context menu disabled either and so will be forced to close their browser and reopen it after which they will go elsewhere and never return to your site.
deadimp
11-06-2005, 09:54 PM
The only way you can try to apply security measures is by creating code that has to be executed by the browser. All a user has to do to go around these "measures" is to open your page by other means, such as using NotePad.
The browser has to have the source HTML file to render the page. In essence, viewing an HTML page is simply like downloading any other file, except the browser parses it. In order to do what you're wishing, you would have to first disable the browser's ability to view the source as a text file (good luck), and then make sure that any application other than the browser (such as NotePad) can't download the file (once again, good luck). However, this also might not work because NotePad might use InternetExplorer to download the files...
What you are asking is not too feasible when it comes to hiding information that the client's browser has to have access to.
joh6nn
11-06-2005, 10:21 PM
this has already been hashed out many times. our official thread on this is here: http://www.codingforums.com/showthread.php?t=4437
this thread is closed
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.