The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> "Protecting" Javascript File
Josh Thomas
post Dec 23 2008, 10:36 PM
Post #1


Member
***

Group: Members
Posts: 59
Joined: 13-November 07
Member No.: 4,306



My mom has a website, and has spent quite a bit of money on having a javascript application developed, and wants to stop people from stealing it from her site.

I know there is really no way to completely protect a script from being stolen, other than to not use it at all, but I am looking for some way to make it slightly more difficult for a novice. The simplest method I have thought of so far is to give the .js file some ridiculous name (like "spyware.js"). Either that or to call several files, all with meaningless names, only one of which is the actual file. What are your thoughts?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Dec 23 2008, 11:43 PM
Post #2


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



Give up.

If this "javascript application" is really something specific to her needs -- which is the only case in which you would normally expect to pay lots of money to a programmer for it --- then it won't be of much direct use to anyone else anyway.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Frederiek
post Dec 24 2008, 04:20 AM
Post #3


Programming Fanatic
********

Group: Members
Posts: 5,146
Joined: 23-August 06
From: Europe
Member No.: 9



http://javascriptcompressor.com/
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Dec 24 2008, 05:01 AM
Post #4


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



It works as little as the rest of them.

Take this.
CODE
alert:('Hello!');


Encode it.
CODE
eval(function(p,a,c,k,e,r){e=String;if(!''.replace(/^/,String)){while(c--)r[c]=k[c]||c;k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('0:(\'1!\');',2,2,'alert|Hello'.split('|'),0,{}))


To get it readable again you just have to replace eval() with for example alert() or document.write(). Paste into a doc and try.
CODE
alert(function(p,a,c,k,e,r){e=String;if(!''.replace(/^/,String)){while(c--)r[c]=k[c]||c;k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('0:(\'1!\');',2,2,'alert|Hello'.split('|'),0,{}))
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Dec 24 2008, 07:18 AM
Post #5


.
********

Group: WDG Moderators
Posts: 9,648
Joined: 10-August 06
Member No.: 7



QUOTE(Josh Thomas @ Dec 24 2008, 04:36 AM) *

My mom has a website, and has spent quite a bit of money on having a javascript application developed, and wants to stop people from stealing it from her site.

Is she afraid that web sites of e.g. competing businesses will copy it? Otherwise, if the script is just a general enhancement it shouldn't matter if it's copied (it's the site's actual content that matters for the visitors).

QUOTE
I know there is really no way to completely protect a script from being stolen, other than to not use it at all,

True, otherwise perhaps sites like dynamicdrive.com wouldn't give away scripts for free.

QUOTE
but I am looking for some way to make it slightly more difficult for a novice.

I've seen some very convoluted attempts, like calling a new script file from within the first script, which is loaded from within an iframe, etc, but then there's an increased risk it causes bugs, or confuses yourself some day in the future when you've forgotten how it all works.

Ajax can also be used to "hide" JS from users (except those that know how to view rendered JS), but making Ajax itself work in all MSIE versions is tricky, and usually it will fail for MSIE users with activeX disabled.




User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Josh Thomas
post Dec 30 2008, 04:13 PM
Post #6


Member
***

Group: Members
Posts: 59
Joined: 13-November 07
Member No.: 4,306



QUOTE
Is she afraid that web sites of e.g. competing businesses will copy it? Otherwise, if the script is just a general enhancement it shouldn't matter if it's copied (it's the site's actual content that matters for the visitors).


She has a handful of scripts that competitors have stolen in the past and used on their own sites, so she is trying to prevent this with some new scripts she has now.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Dec 30 2008, 07:08 PM
Post #7


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,730
Joined: 9-August 06
Member No.: 6



She should consider printing a brochure instead. Or learn to accept the web as it is. happy.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Dec 30 2008, 11:03 PM
Post #8


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



QUOTE(Josh Thomas @ Dec 31 2008, 06:13 AM) *

QUOTE
Is she afraid that web sites of e.g. competing businesses will copy it? Otherwise, if the script is just a general enhancement it shouldn't matter if it's copied (it's the site's actual content that matters for the visitors).


She has a handful of scripts that competitors have stolen in the past and used on their own sites, so she is trying to prevent this with some new scripts she has now.


It would help - of course - if we could see the scripts you are talking about.

But anyway, it's a fair guess that at least some of this could be better done on the server, which would eliminate the other perceived problem.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 16th April 2024 - 01:59 AM