Saturday

Javascript Basics and SEO (search engine optimisation)

What is Javascript?

Javascript is a script that your browser will run [if your browser’s settings allow scripts to be run] as requested by the webpage content being provided by the server. Typically, Javascript is used to manipulate the GUI (Graphical User Interface), calculate and display information, validate forms, etc –examples:

  • GUI: Javascript is often used to manipulate menus (that are displayed/hidden as required).

  • Calculate: from your browser, instead of sending data to the server, then calculating [server side] and resending back new data to your browser, it is much more efficient to calculate & display using your browser/computer!

  • Display: a web page can be better laid out to suit your browser’s window size (to avoid unnecessary sideways scrolling for example).

  • Validate: before sending data from a form, it can be checked to see that necessary bit are filled in or valid information is entered (for an valid email address for example).

  • Etc.: if you are so minded, you can avoid serving content to spiders that they don’t need to see, like form validation code (after all, a spider is not going to be filling in forms on you website!) this also speeds up delivery of your page to the spider - this is a good thing :¬].

Huh?

It’s probably best to see an example – let us show the user a pop-up message. You can’t do this with just HTML. Lookout for the Javascript defined within the ‘script’ tag.

Here is another example:

This link does not take you anywhere - DO NOT CLICK IT !!!!

OK – so where does the SEO come in?

I’m just coming to that! So you can do wonderful pop-ups with Javascript. The problem is that search engines won’t necessarily process your Javascript and if you have links to other pages, then the spider may not know about those pages [and therefore will not crawl them].

What can you do about this?

There are a few simple things you can do:

  • If you think there is a chance that your pages might not be visible to a spider, then simply add some normal [i.e. non-Javascripted] text or images with links to those pages (you can have text links at the bottom of all your pages to all you most important pages).

  • You can define your menus on layer and use Javascript to manipulate those layers (so the spider will crawl your links even if it can’t process the Javascript that hides/shows those layers.

If you want to look into Javascript & HTML some more:

2 comments:

Web Design Northern Beaches said...

Awesome and very useful techniques you shared with us,

I will defiantly try even i know it’s difficult :)

MakeRank said...

SEO has been a recent obsession of mine...my buddy got a job at one of the smaller SEO firms and can't stop talking about it.

Thanks a lot....
SEO Process