p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Javascript How-To (http://p2p.wrox.com/forumdisplay.php?f=87)
-   -   How to stop user from view js code but still work (http://p2p.wrox.com/showthread.php?t=23571)

bekim January 6th, 2005 10:16 PM

How to stop user from view js code but still work
 
Hello
Recently I went to site:http://www.mitsucars.com/eclipse/index.html
I try to get the .js file but I get "Access Denied". Also when I try to get .gif files I get "Access Denied".

How did they do this???

rekha_jsr January 6th, 2005 11:51 PM

Hi

If u want to include javascript in ur page and not to display the code to user then u can create a .js file
and include code like.

<script language="javascript" src="filename.js"></script>



Rekha

Vadivel January 7th, 2005 12:37 AM

bekim, try this .. http://www.mitsucars.com/js/set_style.js -- you would be able to get the js file. Can you explain what you did to get that "Access denied" error?

Best Regards
Vadivel

MVP ASP/ASP.NET
http://vadivel.thinkingms.com

Vadivel January 7th, 2005 12:50 AM

There isn't any way to stop the users from downloading the .js files. They can type the path of the file in the addressbar and download the full source. On the flip side they can also get it from their cache :) Only thing I could think of is to just encrypt the file and make it difficult for normal developers :) ... Be adviced that good developers can also decrypt the file if they want to.

Best Regards
Vadivel

MVP ASP/ASP.NET
http://vadivel.thinkingms.com

Snib January 7th, 2005 09:08 PM

This is very much like the image-protecting issue... it's just not possible. As stated by Vadivel, you logically can't encrypt code perfectly. If it has been encrypted, it must be packaged with a method to decrypt it (to be able to run it) so it really isn't possible to restrict access to client-side scripts you use online.

If there is sensitive information that you need to protect, I suggest going server-side.

-Snib - http://www.snibworks.com
Where will you be in 100 years?


All times are GMT -4. The time now is 02:31 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.