Solved

webserver, how to hide javascript directory

Posted on 2011-02-11
6
579 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

 

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

Turn Insights into Action

Communication across every corner of your business is essential to increase the velocity of your application delivery and support pipeline. Automate, standardize, and contextualize your communication processes with xMatters.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

691 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