This area of the WebWise site, including online courses, is due to close at the end of July 2014.
For the latest WebWise films and articles, visit our new homepage http://www.bbc.co.uk/webwise
If you are looking for alternative online courses for beginners, why not visit the www.digitalskills.com website and help someone get connected?
Print this article

What are Java and Javascript?

Rollover state on iPlayer site

Java and JavaScript are both programming languages that are used to write software applications that can run inside a web browser. Sounds complicated? Read on for an explanation of how they work, where you might come across them and the differences between them.

Wendy M Grossman | 9th September 2010

The simplest web pages are made up of just text plus some coding to tell your browser how to display them.

Slightly more complex pages may have graphics and other design elements to make the page more attractive and the site, as a whole, easier to navigate. They may also have audio and video clips.

But very complex web pages that change in response to user input require programs to make them work. These programs are typically written in either Java or JavaScript because all browsers support them.

Not related

A lot of people think that JavaScript is a sort of simplified version or spin-off of Java. But in fact the similarity of the names is a coincidence, and the two are unrelated except that both are used to write computer programs that can run inside a web browser.

To understand how they're used you need to know that your browser (a ’client’) interacts with a distant computer (a web server) to show you web pages, and that the web server itself also runs many programs that are used (’called’) when they're needed.

So, for example, when you enter your personal information into an address form, that information will be fed into a database program running on the server's end of the connection that will store it, retrieve it when needed, and feed it into other programs – for example, one that sends that information to your credit card company for authorisation.

JavaScript

JavaScript is used for relatively simple functions such as popping up new windows, or checking the information you type into a form to make sure it conforms to what the receiving database expects. So, for example, it will make sure that you have filled in all the required information or that the postcode you've typed in is complete.

Many people disable JavaScript in their browsers because it can pose security risks. But some websites, especially social networking sites like Facebook, will not work as well.

Java

On the other hand, Java is three things. Firstly, it's a programming language. Secondly, it's a ’virtual machine’ - a program (’run-time environment’) you can install on any computer (including mobile phones) that can run any programs written in Java. Those programs will be safely ring-fenced (‘sandboxed’) so that nothing they do can affect the working of the rest of your computer.

And thirdly, it's the set of programs for developers to use that makes all that possible. Java is capable of doing far more complex applications than JavaScript, eg Java is used for the games on mobile phones and web-based applications like Google Docs.

Most people will find that Java has been installed on their computers whether they were aware of it or not. Java was designed with security in mind, but all software has potential security risks, especially when (like Java) it is running programs written by unknown entities across the web. You should make sure you keep Java regularly updated to minimise the risks.

How to enable Javascript

Internet Explorer for Windows

Go to the 'Tools' menu and choose 'Internet Options'.

Next, click the 'Security' tab. Make sure the 'Internet Zone' is highlighted and press the 'Custom Level' button to open the security options.

Look for the entry near the bottom of the list which says 'Scripting', then 'Active Scripting' and make sure it is enabled.

Safari for Mac

Go to the Safari menu and choose 'Preferences'.

Click on the 'Security' button and ensure that the 'Enable JavaScript' option is ticked.

Firefox

Firefox users should go to the 'Tools' menu and select 'Options'.

Next click 'Web Features'. Check 'Enable Javascript' in the main panel and press OK.


Wendy M Grossman

Wendy M Grossman

Wendy M Grossman is a freelance technology writer and author living in London and is founder of The Skeptic magazine.