How Do I Install Javascript
From LoveToKnow Web-Design
Be careful before you ask someone "How do I install JavaScript?" The question betrays an ignorance of the way JavaScript works and what the language really is.
No Assembly Required
The confusion is understandable; people often hear about how they may want to "turn off JavaScript" on their browsers, and this can lead them to imagine that it is an application or an add-on to their systems. However, that is an inaccurate view - when you "turn off" JavaScript, what you are really doing is turning off your web browser's ability to read and execute JavaScript code within the web page.
Under the Hood
JavaScript itself is actually code that is inserted into the HTML page and is usually never seen by the average user. It provides added functionality and interaction for the site, from simple things like adding the current date to the page to complex tasks like gathering and processing information about the user and their environment. Sometimes the scripts will send information back to the server, and sometimes it simply executes within the browser itself.
That is both the blessing and curse of JavaScript - while it can be quite useful and enriching, it can also be annoying and malicious. The pop-up ads that become so annoying that browsers have specific "block popup" functionality built in? Those are done with JavaScript. Sometimes the information gathered by the script lets the programmer behind-the-scenes know how they can exploit weaknesses in your browser to install of viruses, malware, or spam-generating programs.
For this reason, several security experts recommend that users (especially users of Microsoft Internet Explorer) disable JavaScript. This means that when the browser looks at the code of a web page (or is "served" the code by the server) it will only execute the "safe" HTML codes, and ignore the JavaScript code snippets completely. This makes the web a duller experience, and breaks some websites completely, but some feel it is better to be safe than sorry.
Not "How Do I Install Javascript," But "How Do I Write It?"
The good news is that since JavaScript is just a language, you don't need anything more powerful than NotePad and your brain to write it. Of course, you do need to know how to write it, but there are many programming tutorials online that can help you with that task. JavaScript is one of the first ways people took the web beyond just static, one-way communication, and as a result the top methods and best practices are already worked out. In fact, many programmers use JavaScript to dip their toes in the world of code before moving on to more robust languages like Java or Ruby.
Copying Scripts
Because JavaScript is such a venerable language, there are also many, many free scripts available online that you can copy and paste into your own HTML pages. There are basically two kinds of these:
- External .js Files - Instead of ending in the ".html" suffix, ".js" files are simply JavaScript code that is referenced by an HTML file, usually by a call within the HEAD of the document. This tells the browser to not only look at the HTML file but also to grab the .js document and have it ready to execute when various functions are "called" within the HTML file.
- JavaScript in-line - It is also possible to designate parts of the document that are set aside with <!--JAVASCRIPT CODE HERE--!> and have the code execute right within the HTML.
Remember, the user may have heeded the warning of many security experts and disabled any JavaScript functionality from their browser - so it's a good idea to only have "extras" on your site set up with that kind of code, and either rely on HTML, CSS or some other coding method like AJAX or Flash.
Regardless of your choice, most scripts come with directions of how to configure the code exactly to do what you need, and usually in a safe way that will protect both your server and your end user.
Learn More
This page has been accessed 25 times. This page was last modified 00:51, 26 October 2009.
© 2006-2009 LoveToKnow Corp.
Visit us on facebook