<< Home

How can you hide scripts?

You can hide java script by putting it into an external javascript file. Although a technical person would be able to find the file. To do this you can reference the external file as you do with a css file. Here's an example of how to do this.

<script type="text/javascript" src="http://www.anotherdomain.com/myhiddenfile.js"></script>

The purpose of this is so that your script cannot be directly viewed in the source of your web page. This could stop others copying your script so in reality there is no way to hide javascript.

For the assignment you need to explain how javascript cannot really be hidden and that scripts placed on other websites are readily available to be copied. Try to find a script on another site and put it in your site to explain.