Solved

webserver, how to hide javascript directory

Posted on 2011-02-11
6
558 Views
Last Modified: 2012-05-11
I have define root directory /var/www/html.  "index.html" is in that directory.  It references myjs.js in the /var/www/html/javascript/ directory.  

How do I prevent the user from seeing the javascript file ( https://myserver/javascript/myjs.js.)? I am using the Mongoose Webserver.
0
Comment
Question by:rgbcof
  • 3
  • 3
6 Comments
 
LVL 35

Accepted Solution

by:
torimar earned 500 total points
ID: 34875742
You simply cannot prevent users from seeing javascript files. Javascript must be freely accessible for the user's browser in order to correctly display the web page. If it is accessible to the user's browser, it is also accessible to the user.
0
 

Author Comment

by:rgbcof
ID: 34875811
Is there a javascript command that pulls the javascript content into the html files.  I am OK with that.
0
 
LVL 35

Expert Comment

by:torimar
ID: 34875841
You can place the complete javascript content inside your HTML file by including it between <script> tags:

<script type="text/javascript">
//JavaScript goes here
</script>

Open in new window


For more, please see here: http://www.howtocreate.co.uk/tutorials/javascript/incorporate
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Closing Comment

by:rgbcof
ID: 34875853
Thank.  I just want to know if hidding javascript was possible.
0
 
LVL 35

Expert Comment

by:torimar
ID: 34875915
As I said, it isn't. Developers who want to 'protect' their intellectual 'property' often turn to "obfuscating" the code by using tools on it that make it humanly unreadable.
But even then it is still fully functional and may be copied and used by anybody else. Needless to say, users could also pass it through "unobfuscating" tools.

Generally, obfuscation is not a recommendable practice because it is mainly used by malware authors. So if you did it, your code would become suspicious.

0
 

Author Comment

by:rgbcof
ID: 34875943
Thanks for the obfuscation and the warning against using it.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
The viewer will learn how to count occurrences of each item in an array.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now