Solved

webserver, how to hide javascript directory

Posted on 2011-02-11
6
573 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

733 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