Subscribe via RSS FeedRandom Post

Java Vs. JavaScript: How Improper Use Of JavaScript Can Damage Sites

View Comments September 23, 2009 | Tony Williams

It is quite understandable that Java and JavaScript are often confused for one another. It’s not just that they have very similar names. Both are Object Oriented Programming languages that were created for large IT companies (Java for Sun Microsystems, JavaScript for Netscape) in 1995. The two languages, however, are different, and it’s important not to try to use them interchangeably.

Distinguishing Between Java vs. JavaScript

Functionality is the primary distinction between Java and JavaScript. Java is a full language that creates standalone programs such as the very popular Java applets. These are separate files that may be embedded into an HTML document on your browser but are not part of that document. The Java code is entirely separate. JavaScript cannot create standalone programs, though. JavaScript, in contrast, consists of code that is written directly into the HTML document, so it is actually part of the document.

Advantages to JavaScript vs. Java

Using JavaScript programs as part of the HTML documents can have its advantages. The language is easy to understand and use, and changing the program is simply a matter of rewriting some of the code in the document. Conversely, a Java program can be more complicated and is more of a hassle to change. Java programs must be written in machine language and then compiled into a form where it will fit into the HTML document where it is resting. Changing the code is not a simple matter of rewriting; the changes must happen in the original code, which must then be recompiled and reinserted into the HTML document all over again. javascript 600x438 Java Vs. JavaScript: How Improper Use Of JavaScript Can Damage Sites

Advantages to Java vs. JavaScript

Nevertheless, what you give up in ease of use you gain in functionality when it comes to Java. Java is a much more versatile language. Since it can create standalone programs, it can be used to design programs that can fit into almost any site and serve a wide variety of purposes. If you are a more experienced programmer, you will probably prefer Java. Most Java programmers are familiar with C and C++, while anyone with basic HTML programming experience should be able to use JavaScript with little difficulty.

Reading Java and JavaScript

Remember that reading Java and JavaScript programs requires different platforms as well. It is possible that your browser supports both Java and JavaScript, but you should keep in mind that just because a browser supports one does not automatically mean that it will support the other.

Since websites coming out now a days are so dynamic, web hosting providers and offering java web hosting solutions with their account. Do check for the options before buying hosting service.

JavaScript was great when it was introduced. It allowed developers to really spice up their sites and to actually make them interactive with the client. A website can also gain some control over the browser as JavaScript is designed to tell the various browsers how to interpret code and allow a website to change independent of the server. When you scroll over a button or see pictures changing on their own or when you click a button and fill out a form, that could all be JavaScript. It was also easy to implement and could easily be integrated into HTML. It made it easy for many people to make great sites but there were also some dangers with JavaScript. With JavaScript you can create popup windows or even re-direct people to another site. This is a major security issue.

Improper Use Of JavaScript: What happens if an incorrect window pops up?

It’s great to have popup windows and to have forms available for customers to fill out. It’s almost essential for any site that is eCommerce based. The obvious problems with popup windows and JavaScript is that it is much easier for hackers to enter your site with JavaScript and embed a popup window in your site requesting your customer’s private information or they can even re-direct customers to a new site without the customer even knowing it. Even worse, it is very hard to detect when and where these popup windows will come up in your site. Done properly it could fool just about anyone into giving up sensitive information. If you’re a bank or an online poker site you will be transferring funds and that can easily be re directed through the use of JavaScript.

Improper Use Of JavaScript: Incorrect features can happen anywhere!

Using JavaScript improperly can cause unique features to randomly appear and it will happen at the wrong time and location on a site. Pictures could move independently when you don’t want them to. Buttons can change independently and even worse popup windows can just spring up. So it can completely ruin the visual looks of a site. Another problem is if you want to use JavaScript to create popup windows and the user has the pop up windows feature turned off in the browser, the client will then never even see that information or feature. It is great to still use JavaScript and even though there might be some security risks one should always keep in mind that there are always security risks with any option you choose when you are building out your site. Weigh the options and make the best decision for your site.

Tip: Click here to run a free scan for common PC errors

GD Star Rating
loading...

Tags: , , ,

Category: Blogging

Next Post: »»

Prev Post: »»

About Tony Williams: Want to get more out of your PC, the internet or your mp3 player? Onetipaday.com is here to provide clear simple tips and guides to help you achieve just that. Each tip will be easy to implement and will take no more than 5 minutes to read and implement. What will you learn today? View posts.

Comments (View Comments)

Trackback URL | Comments RSS Feed

  1. good comparison; can I share this article on my site?

  2. Scott says:

    I'm not sure who the audience is for this. I can't imagine any programmer having any question about the two.

  3. good comparison; can I share this article on my site?

  4. Scott says:

    I'm not sure who the audience is for this. I can't imagine any programmer having any question about the two.

Leave a Reply




If you want a picture to show with your comment, go get a Gravatar.

blog comments powered by Disqus