Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 6th, 2005, 10:16 PM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 245
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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???
 
Old January 6th, 2005, 11:51 PM
Authorized User
 
Join Date: Sep 2004
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
 
Old January 7th, 2005, 12:37 AM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel
Default

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
 
Old January 7th, 2005, 12:50 AM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel
Default

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
 
Old January 7th, 2005, 09:08 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

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?





Similar Threads
Thread Thread Starter Forum Replies Last Post
JS to check for form Validation does not work - pl jennypretty Classic ASP Basics 4 December 11th, 2008 11:18 PM
Form and SubForm stop work lijandra Access VBA 0 August 16th, 2006 12:48 PM
Stop the user tapping Brendan Bartley Access 8 January 10th, 2006 08:44 PM
Prevent user input while JS executes matty1stop BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 0 November 17th, 2005 10:35 AM
How to stop ' stuffing up you code tdaustin Classic ASP Basics 3 June 26th, 2003 09:52 PM





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