Click to See Complete Forum and Search --> : We Must Protect The Source


David Harrison
12-20-2002, 04:02 PM
How can I prevent people from looking at the source of one of my webpages by clicking on View - Source or right-clicking on the page and clicking View Source or any other way that I don't know/can't think of right now.

Beach Bum
12-20-2002, 04:39 PM
You cannot prevent people from looking at your source - period.

But for a partial solution -

There are some javascript routines that disable rightclick, which you can find in many of the libraries on the net.

You can put oncontextmenu="return false" in the body statement and this works to disable right click on many browsers (but not all).

You can put your page inside frames so when you do view source from the browser menu you just get the frames page.

But in the end . . . you can run . . . but you cannot hide.

khalidali63
12-20-2002, 05:45 PM
As much as you may want to hide your code, the truth is that JavaScript is an open source scripting language,and it is intended for the people to see it.And if for some reasons you do not like the open source stuff,join hands with Microsoft products.
cheers

:-)

Khalid

David Harrison
12-22-2002, 09:13 AM
Thanks to Beach Bum for referring me to some of the libraries on the net but do you know any addresses because I'm useless at finding stuff.
Thanks also to khalidali63 although you sent a rather mixed message, it may have been just me but thank-you for replying all the same. (If I sound impolite then I am sorry I don't mean to be.)

Beach Bum
12-22-2002, 11:59 AM
http://www.dynamicdrive.com/dynamicindex9/index.html

there are several on this page

aepstar
12-22-2002, 12:49 PM
There is one thing which lets u encode ur javascript

check it out:

http://msdn.microsoft.com/downloads/default.asp?URL=/downloads/sample.asp?url=/msdn-files/027/001/789/msdncompositedoc.xml

however if somone has time and effort he can decode ur script, but 99.9 % of ur visitors will NEVER know how to get the original source of ur script.

peace

jeffmott
12-22-2002, 03:11 PM
But for a partial solution -
There are some javascript routines that disable rightclick

I wouldn't even deem this a partial solution. All this does is strip the user of a handy menu with shortcuts to frequently used commands. Disabling right click will 1) annoy your visitors and affect their opinion of your site, and 2) delay people who do want to view your source by perhaps a second since you simply force them to use the toolbar instead of right click.

There is also no real reason for wanting to hide your markup. HTML is one of the smallest and least complicated computer languages in use. Anything you can think to do with it has already been done.

JavaScript, however, is actual programming. A couple hours of work could potentially produce a script that is unique and marketable. So it is understandable to want to protect this. Aepstar's reference the Microsoft's Script Encoder is probably the best solution, but still not very practical. A simple search at Google for "Script Encoder." The first result is Microsoft's documentation for Script Encoder, and the second result describes how to break the encryption and provides a program to do this for you. This makes your security break against anyone who doesn't know how to use a search engine. You might say, "but it at least protects against the average user." I find this rather silly because it is the average user who would have absolutely no interest in seeing your code. And if they could see it, they wouldn't even understand what they were looking at. Keep in mind they can't even use search engines yet. Even if the average user still did want your source for whatever reason, all they have to do is call up a "techie" friend and direct them to the page. Eight seconds later even the average user now has your source.

And so, it is useless and a complete waste of time to attempt to hide your source. And any "partial" solution only frustrate users and lowers their opinion of your site.

Zach Elfers
12-22-2002, 03:12 PM
There is no way to protect your source, but just as an extra procaution, make all your scripts eternal.

jeffmott
12-22-2002, 03:17 PM
but just as an extra procaution, make all your scripts eternal

Again, this only delays people by a matter of seconds. It's not even worth the effort.

alcodes
12-22-2002, 09:28 PM
Make the index page a frame with 100% rows and add this script to all pages but index.html:
<script>
if (parent.frames.length==0)
window.location.replace("index.html")
</script>

This code will send them to inex.html if they are not in frames, so they cannot view the source of any part of your site but the index.

no solutions, quite true, Jscript can be disabled

Ryan
12-22-2002, 10:20 PM
Originally posted by aepstar
lava u r such a huge dork! u cant even make css styles only html and now u wanna protect ur source???? are u kiddin? tell me who copies ur source coz its gonna make me cry and laugh both?

what do u have? a super page who nobody has? i bet u r just a phuqin-geocities-account-dick with ur crazy homepage just about urself

please i dont think its stupid thread i just think that it is asked by the wrong person.

i can only speak for myself, but i really think that this was completely unnecessary and utterly stupid. take your ranting elsewhere.

jeffmott
12-22-2002, 10:28 PM
so they cannot view the source

Cannot is the wrong word here.

I don't think this type of question should continue to be answered with a "possible solution" and at the very end a very brief remark of how it doesn't actually work, if it's mentioned at all. If you still want to present a solution then tell it how it is. Make the very first thing you say, "This will delay users from viewing your source only."

ShrineDesigns
12-22-2002, 10:34 PM
lmao

don't put it on the net you don't want people to see it

khalidali63
12-23-2002, 12:26 AM
LOL ..
shrine...so true..
I'd say don't event put it on ur hard drives, rather keep it in even safer place,( brain)...:-)

sweet..

Khalid

aepstar
12-23-2002, 05:10 AM
Originally posted by alcodes
Make the index page a frame with 100% rows and add this script to all pages but index.html:
<script>
if (parent.frames.length==0)
window.location.replace("index.html")
</script>

This code will send them to inex.html if they are not in frames, so they cannot view the source of any part of your site but the index.

no solutions, quite true, Jscript can be disabled

year roflmao, just save the page and open it in html editor...

David Harrison
12-23-2002, 12:24 PM
Thanks for all of your interest in this thead everyone and just for the record I do have a geocities account but it isn't about me and so far I haven't advertised it aepstar. Insulting as you may be I did go to the web-site as you suggested and downloaded a source encoder.
By the way, what's so wrong about not knowing css, I've never had to know any before.

khalidali63
12-23-2002, 12:57 PM
Nevermind anything anybody says here,
as long as you can extract your answer,we all began from scratch,and I'd say most of us have had the days when we we knew a bit little then the others.
No one ever can claim an authority on any field of knowledge,since knowledge is evolving.

chao.

Khalid

alcodes
12-23-2002, 02:35 PM
aepstar, if you read what I said you wouldnt flame me, anyways there is a way around saving the page: DISABLE RIGHT CLICK

dotnetanimal
12-23-2002, 02:42 PM
Just a thought but you could take code that you want to protect and run it server side if that is an option. C# is very similar to JavaScript in its braces and what not if you are running on IIS. There are also ways you could rap this up on non-microsoft platforms or if you have the option you could place the logic in another medium like a dll or something like that.

jeffmott
12-23-2002, 03:24 PM
there is a way around saving the page: DISABLE RIGHT CLICK

I'm trying not to resort to any insulting, but this maybe deserves a little flame. This is completely wrong. Not only can you easily work around not being able to right click, but the option to save the Web page isn't even in that menu!

Zach Elfers
12-23-2002, 03:27 PM
Originally posted by alcodes
aepstar, if you read what I said you wouldnt flame me, anyways there is a way around saving the page: DISABLE RIGHT CLICK

Your C++ code in your signature is wrong. You forgot an ";" after the: cout << "HAHA!";

khalidali63
12-23-2002, 03:37 PM
Believe me guys,come JavaScript 2 out in the industry,allaots of people will re-think there web development habits.
Most certainly,MS utilities users and WYSIWYG users will have the time of thier lives..lol

Khalid

alcodes
12-26-2002, 10:38 AM
I noticed a long time ago, I should fix it :)

alcodes
12-26-2002, 10:39 AM
jeffmott, you dont use IE do you?

jeffmott
12-26-2002, 10:55 AM
In the right click menu I see

- back
- forward
- save background as
- set as background
- copy background
- set as desktop item
- select all
- paste
- create shortcut
- add to favorites
- view source
- encoding
- print
- refresh
- exort to microsoft excel
- properties

None of which is save as.