faqts : Computers : Programming : Languages : JavaScript : Document

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

55 of 75 people (73%) answered Yes
Recently 8 of 10 people (80%) answered Yes

Entry

Can I hide my client-side javascript source from the browser user?

Jan 21st, 2003 04:38
lee goddard, Alexander Voytsekhovskyy, Ryan Buterbaugh, David Zheng, Martin Honnen,


No, it can't be done.  You can try to hide it within the html code or 
make .js files, but there is no surefire way, it can always be found 
by the persistent user.  However, you can make it virtually illegible, 
by running a (preferably automated) search-and-replace over your code, 
changing to random characters all human-intelligable values, such as 
variable, function and layer names.
If you are happy hiding your source from users of MSIE5+, you could 
have a look on the Microsoft website for JSEncoder.
On the other hand, you might consider this a rather immoral attitude.
If you're determined to retain some kind of intellectual property 
rights, you're probably better off working in JAVA, C, or C++.