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
Solved

webserver, how to hide javascript directory

Posted on 2011-02-11
6
572 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
When should I use a controller? 3 40
PHP Form Calculate Total Price 10 79
Designing an online application with Ipad, smartphone app capability 2 25
Company website 6 30
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

856 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