SEO Services > SEO FAQ > Javascript

Will using Javascript on my site affect my search engine ranking?

There are a lot of mixed messages out there when it comes to the topic of whether or not using Javascript makes for good search engine optimization. Some people are avid believers that it should not be used at all, while many others will propose all kinds of different ways to use Javascript sparingly. So if you're considering whether or not to use Javascript on your own website, or you're just wondering what the fuss is all about, here we're going to attempt to lay out the pros and cons of Javascript as it relates to search engine marketing.

The big attraction to Javascript for web developers and designers is that it is a relatively simple programming language that can allow you to create many effects that traditional HTML simply cannot. In addition, Javascript is a great solution to the problem of code bloat. Code bloat occurs when the size of an HTML file used for a web page approaches the limits set by the search engines. Exceed these limits, and you will be penalized with a lower ranking in the results pages.

However, there are plenty of critics out there who will tell you that using Javascript can also harm your rankings, because it makes it harder for the search engines to crawl your site.

The reason for this is relatively simple. First of all, the search engine crawlers have a lot of ground to cover these days. And crawling through lots of Javascript code makes it very difficult for them to get to the information they are really looking for, which is keywords and relevant text and information about your site. Therefore, since the crawlers have a difficult time actually finding out anything of relevance about your site, it can hurt your SEO strategy.

Another reason people tend to look down on the use of Javascript is that developers will often put navigation links inside javascripts. Since these links are invisible (hidden within the code) to the crawlers, they will not follow those links, and cross and in-site linking are key to good SEO marketing.

However, there are ways around these problems, and the foremost solution is to externalize your Javascript code. Now, if you have only a few lines of Javascript and a lot of keyword rich text on a given page, in all honesty, it probably won't affect your ranking enough to matter. But if you're going to incorporate a lot it, externalizing your Javascript is definitely your best bet.

To externalize your Javascript, simply copy the javascript code you want to use into a Notepad files and save it as "filename.js". Be sure you change the file type to "all files" when you save, so that Notepad doesn't attach a ".txt" to your file. Once you've saved the file, upload it to your webserver. From here, you can reference the file in your HTML coding, as shown below.

Since the javascript itself is saved separately, you'll spare the crawlers from having to go through hundreds of lines of code when analyzing your site, making for much quicker recognition of your page value.

All things considered, the use of Javascript isn't going to make or break or break the SEO strategy you've planned out using various SEO tools and long hours of keywords research. There are all kinds of other strategies that may more directly affect your ranking, such as link building and proper keyword density. But this will make it easier for the crawlers to process your site information despite using Javascript, and that's never a bad thing.