header
 
     
 
pixel
pixel pixel

Making your javascript search engine friendly

When adding javascript, it can be a case of "out of sight, out of mind" when it comes to your search engine optimisation. You may have spent days fine-tuning your keywords, carefully crafting your title, meta tags and visible copy. But all your exquisite keyword research can be spoiled by excessive javascript code. Search engines determine your web page's relevancy to a searched phrase by assigning importance to the keywords found towards the top of your page. They also look at keyword density: how often the keyword is repeated in the webpage.

Typically, most javascript code is found at the start of your webpage, between the head tags. All that code pushes your visible text further down the webpage and some search engine spiders will conclude the visible text is less important. All those extra words of code reduce the keyword density of your keywords. And worst of all, some spiders penalise you (or don't index your page at all) if there is too high a code/content ratio.

But there's no need to throw out all your javascript just yet. All these issues are resolved by moving all your javascript code into a separate file. For example, here is a typical HTML page with javascript in the head section.

example.html
<html>
<head>
<title>Javascript Test Page</title>
<script language="Javascript">
    function confirmIt(where, msg)
        {
        if (confirm(msg))
            {
            window.location.href = ''+where+'';
            return true;
            }
        else
            {
            return;
            }
        }
</script>
</head>
<body>
<a href="javascript:confirmIt('otherpage.html', 'Are you sure?')">Click here</a>
</body>
</html>
What we do is copy all the code in between the <script> </script> tags and paste them into a separate file javafunctions.js. The filename isn't important - you don't need to use the extension js (it just makes it easier for you to identify what the file is when scanning a directory). Here's the content of the new file:

javafunctions.js
function confirmIt(where, msg)
    {
    if (confirm(msg))
        {
        window.location.href = ''+where+'';
        return true;
        }
    else
        {
        return;
        }
    }
Now we amend our original html file to remove all the javascript. It's a simple case of using the <script> tag linking to the new file:

example.html
<html>
<head>
<title>Javascript Test Page</title>
<script src="javafunctions.js"></script>
</head>
<body>
<a href="javascript:confirmIt('otherpage.html', 'Are you sure?')">Click here</a>
</body>
</html>
You can use your separate javascript file to contain more than one function. Your webpages are search engine friendlier and you also have the added bonus of being able to call your javascript functions from other HTML pages, saving you from repeating code across multiple pages.

Unhelpful Helpful Rating 3.1 (score out of 5, no. of ratings: 54)
Comments
Comment by Alexey on 2006-03-02
Excuse for intrusion, but at me not the big question. How you think how many people on the ground smoke and how many have ceased?

Comment by mbtshoesmasai on 2010-07-29

You select MBT Shoes to wear without reason because of its large charm. The health care of MBT Footwear is its advantage. MBT Shoes Clearance with soft and smooth surface is popular exercising shoes in daily life. Discount MBT Shoes can exercise your muscle to make you become the focal point in your office or other business occasions. MBT Shoes Cheap are made of high quality Nappa leather with a lasting effect. The natural unstability of MBT Masai Shoes compels the torso to keep body balance and stimulates small muscles around spine joint for a protection. As a fitness equipment, called Medical Shoes, MBT Outlet can effectively exercise small muscles around joints, strengthen muscles strength, and burn more fat. your cheerful experience and exercise benefits when you are walking with MBT Sandals can effectively treat obesity. At the same time, MBT Womens Shoes heel with 5 centimeters height can make you look taller. Wearing MBT Walking Shoes can reduce the pressure on knee and hip joints. Now MBT pushes out all kinds of shoes such as MBT Lami, MBT Changa, MBT Kaya and so on.
Welcome to our website: http://www.mbtshoesmasai.com

Comment by Coach Handbags on 2010-07-30

In recent years, Coach handbags has indeed built up quite a reputation and enjoys increasing popularity with consumers. With its popularity, Coach Bags become the most preferred brand throughout the world. Gucci Handbags are the obvious choice for many fashion conscious business women and those with a preference for timeless oakley sunglasses classic styles and they wear so well and go with nearly everything in your closet.This bag is really worth owning.Coach Wallets was on the Chinese market for nearly 50 years. You can even see older people carry a coach starting line handbag. Cheap Coach Purses Coach Bags are excellent for high quality and low price. These bags are more and more what people want.As Coach Outlet you smart crocodile, Caiman fuscus Coach Crossbody Bags crocodile clutch his last, which has five versions to choose from: orange,Chanel Handbags brown, gold, black, dark silver to make. Coach Op Art Bags The five drawings of the Viper clutch are per kart.

You will get more results out of your workouts - MBT have technology in the sole design that make your working more efficient and burn more calories. mbt outlet With every step, the instability activates Cheap MBT Shoes your muscles and the whole body is stimulated as your walk more and more.mbt shoes outlet have a curved pivot sole that copies walking on soft moss. The sole turns even, flat ground into uneven terrain. The discount mbt shoes challenges the muscles to work harder with every step you take. The unique curved sole works by providing instability and makes the muscles of your body more engaged and also helps burn more calories.MBT Sandals MBT VOI Shoes

MBT Salama Sandal

MBT Habari Sandal

MBT Fumba Sandals

Post a Comment
Name
Email
(optional)
Comment
RatingUnhelpful Helpful
Security Image* (this is just to prevent spam submissions)
Security Image