Showing posts with label JSON. Show all posts
Showing posts with label JSON. Show all posts

Saturday, December 13, 2008

So, what is Javascript?

Virtually every personal computer in the world has at least one JavaScript interpreter installed on it and in active use. JavaScript's popularity is due entirely to its role as the scripting language of all Browsers. JavaScript is a general purpose programming language that was introduced as the page scripting language for Netscape Navigator.

JavaScript is still widely believed to be a subset of Java, but it is not. The Java- prefix suggests that JavaScript is somehow related to Java, that it is a subset or less capable version of Java. JavaScript is not interpreted Java. Java is interpreted Java. JavaScript is a different language. Java was introduced by Apple into their Browsers early on, but it was too complex and it failed, often, and so Apple fell into step and delivered JavaScript as their de facto Browser language too.

JavaScript has a syntactic similarity to Java, much as Java has to C. But it is no more a subset of Java than Java is a subset of C. It is better than Java in the applications that Java was originally intended for.

JavaScript was not developed at Sun Microsystems, the home of Java. JavaScript was developed at Netscape. It was originally called LiveScript.

The -Script suffix suggests that it is not a real programming language, that a scripting language is less than a programming language. But it is really a matter of specialization. Compared to C, JavaScript trades performance for expressive power and dynamism.

As mentioned earlier the books available for Javascript are just poor, the main one we would recommend is JavaScript: The Definitive Guide

Friday, December 12, 2008

How can Javascript deliver the goods for SEO

I seem to have stimulated a good amount of interest amongst our tech team following on from my post on JavaScript. To be clear there are two good reasons to keep an eye on JavaScript development - Search engine optimisation and Social Media.

In SEO the key is all about separation - let not the JavaScript get near your content. In Social Media, the more you use it the better your site - a real dichotomy. There are two ways to employ JavaScript on a site and they are very similar to the way you deal with CSS:

  • Use external files to hold the code

  • Progressive Enhancement


The first item is self explanatory, the second is a classic technique that we use in SEO where we want a specific action to occur. The action would depend on whether JavaScript was turned on or turned off. If JavaScript was turned on then the JavaScript actions would occur, if JavaScript was turned off, then the user would simply see a standard hyperlink for example.

In Search engine optimisation terms; whether JavaScript is on or off, a search engine robot would simply see a link. In English terms; we build a page with solid code and build enhancements on top. If the enhancements fail, the page will not show an ugly error, simply a less good way of getting to the results we had intended.

Just in case you are thinking 'what possible use would that be to me?'. Well one instance could be that if you wanted to show your expert list of closely related sites that are stored in your Delicious account you could use Progressive Enhancement techniques on your web page.

As you would rather keep your list in Delicious, where you can add to it or modify it easily - rather than copy the list, you could place it on your web page with some clever JavaScript and keep it up to date through Delicious.

Your web page would use some JavaScript, (it would need to use JSON - activated through JavaScript because JavaScript works on calls to your own server and no elses) and if it all worked it would show the list you were hoping for. If it failed it would simply show a link to your Delicious account and your users would have to click off your page to go see the list - a lot less desirable - but at least it would not show an error. In the main of course it would work and when it did you would be certain that the list shown was the most up to date list and this would save you the trouble of maintaining the list.

In both cases I would be passing a link to my Delicious account and allowing my web page readers to get the information that I wanted to give them and if Javascript, JSON or Delicious failed, no one would know and my page would be unruffled.

As you can see Progressive Enhancement is a technique that is employed for usability as well as for SEO. Progressive Enhancement protects the integrity of your page and gives benefits to user. This is a real win win concept, that requires an understanding of JavaScript, and is a core component of Web 2.0 sites. So we need to keep an eye on JavaScript for the future.

It is only recently that JavaScript has returned to being considered again as a genuinely useful piece of code. As in the early days JAVA kept on failing and different browsers then had different flavours of JavaScript - as a result, lots of sites failed and helped to make the web the nightmare that it was back then...

Nowadays JavaScript has settled down and really is at the heart of Web 2.0. As Web developers, SEO specialists and consumers, we need to be aware of the benefits that JavaScript delivers to help make the web a more optimistic place.