Click to See Complete Forum and Search --> : Compile and Protect Javascript???
Muzza
10-31-2003, 04:02 AM
Hi,
I am building a service for a customer and he wants the application protected. This means a need to hide the javascript from the "cut and paste" community!!
Is there a way to compile the javascript to bytecode so that even though it runs in the browser a user is not able to copy and edit the code.
Thanks,
Muzza.
Gollum
10-31-2003, 04:29 AM
Well, no. But you have described Java in a nutshell ;)
Netscape 4 and 6 both support a concept called "signed scripts", but they are not compatible and IE doesn't so go figure...
There are things you can do to make it difficult for the "cut and paste" community, but that's all. The Javascript still has to download in text form and it will still be typically stored somewhere on the computer in a file.
Probably the best thing you could do is put copyright notices in your code - that should scare off at least a percentage of the community.
Muzza
10-31-2003, 05:13 AM
There are things you can do to make it difficult
OK, what are these "things"?
Ta,
Muzza
Lotus
10-31-2003, 05:18 AM
Isn't it possible to save the JavaScript in an external file and then link it to your page? That way only the link to the JavaScript file is shown, not the actual code.
Muzza
10-31-2003, 05:23 AM
1) The user can type "http://www.domain.com/script.js" into a browser and download the file
or
2) The script has already been downloaded and is available in the browsers' cache.
So no, that solution only makes it a little harder..
Gollum
10-31-2003, 05:37 AM
save the JavaScript in an external file and then link it to your page
Well, that's one...
Other alternatives are to encrypt your script using some key and then write it out in decrypted form to the document at load time - the "view source" will only show the encrypted version. However - the decryption code must be visible (or it won't work) so it doesn't take an awful lot of skill to change the script to display the code.
Lotus
10-31-2003, 05:50 AM
1) The user can type "http://www.domain.com/script.js" into a browser and download the file
If the file is on a FTP server you'd have to be logged in to download the file...
Charles
10-31-2003, 06:00 AM
Originally posted by Lotus
If the file is on a FTP server you'd have to be logged in to download the file... If you did then the browser would also have to be logged in.
"I'm sorry captain. I can na change the laws of physics."
Muzza
10-31-2003, 06:26 AM
Originally posted by Gollum
Well, that's one...
Other alternatives are to encrypt your script using some key and then write it out in decrypted form to the document at load time - the "view source" will only show the encrypted version. However - the decryption code must be visible (or it won't work) so it doesn't take an awful lot of skill to change the script to display the code.
So how would you encrypt it....could you point me towards any examples? I know that it i impossible to totally hide your code - even compiled code can be reverse-engineered - but if it is too confusing for 99.9% then it is a step forward.
Charles
10-31-2003, 06:38 AM
Originally posted by Muzza
but if it is too confusing for 99.9% then it is a step forward. We get lots and lots of people asking us how to hide the code but not a single question about how to defeat these measures. They all figure it out for themselves.
Besides, you are trying to hide things from the "cut and paste" crowd. We are the "cut and paste" crowd. You've got a lot of nerve asking us to defeat ourselves.
Khalid Ali
10-31-2003, 07:50 AM
Lately we have way too many discussions on this issue.
"The Internet is open source"
make note of it,Its against its very idea to hide the code.
You can not do that perfectly anyways,so why waste your time,
Heck compiled applications can be hacked given the determination...
Muzza
10-31-2003, 08:04 AM
Utterly bimbo-esque commentary.
Some components of the internet infastructure are open-source.
The internet is not one thing and is not open source.
Thanks for repeating my comment that compiled code can be reverse engineered.
And it is not illegal nor immoral to try and create new functionality and make money out of it. The idea behind open source is to improve software. Where the software is merely an enabler of a service then it is right that this can be copyrighted and the service protected.
I contribute to a couple of open source projects, so don't lecture me on the benefits and the drawbacks. I also code on a commercial basis, cos open coding don't pay the rent.
Please make note of that.
Khalid Ali
10-31-2003, 08:10 AM
woah...
I did not mean to hit the "Bulls Eye"...
But I still am sticking to my opinion.
Of course there is nothing wrong with money making,but if you wanna make money on public resources(which internet's intent was couple of decades back)
Then good luck....you are not alone..
Lighten up....:D
Muzza
10-31-2003, 08:16 AM
Not stressed, just felt your tone a tad condescending.
Or is that just part of the moderator job spec ;)
apology accepted:eek:
Khalid Ali
10-31-2003, 08:46 AM
Originally posted by Muzza
apology accepted:eek:
don't faltter yourself...and lets just stop right here..rather then taking it to next level...I posted a comment,just as you had your post.If you don't agree with that(and you already have shown your disagreement).so thats it, stretching this discussion any more is not the purpose of the post nor it is desired..
Muzza
10-31-2003, 09:09 AM
oh dear, and there was me thinking the emoticon was the universal expression of humour.
Sorry for winding thee up. All done in the best possible taste, I assure you.