June 22, 2005

Changing the page title using javascript

Don't do this!!! There is absolutely no point in changing a page's title by using Javascript.

Ok - the users might get some benefit because the title is now more appropriate.

The code, if you really need to do it is

HTML:
  1. <script language="javascript">
  2. document.title = "The new title goes here.";
  3. </script>

But here's my thought process

  • Search Engines will only see the original title, not the revised title
  • Search Engines will therefore see either a generic or a spammy version of the title and the user gets the cleaned up version
  • If the title isn't right in the first place can you be accused of cloaking?

Now, that's a serious risk, cloaking, can you afford that allegation?

Simpler, I think, is to use the server side processes to set the title correctly before the page ever gets to the browser.

And I have to stop reading my server logs, but yes, people actually search Google for this information!

Also on this site

Tags: ,

2 Comments »

  1. Thanks a lot 4 the information…
    I’m a rookie in SEO stuff yet and I was thinking to use javascript 4 SEO, like changing my title tag.

    Uff! :)

    Comment by BetoAveiga — April 30, 2007 @ 12:33 am

  2. I have just found this useful for myself. BUT, not for any SEO purpose. I’m developing a Web 2.0 application, so it’s all just a single page that the SE’s never see, but I still wanted to change the document title so that users can see where they are and what they are doing. In this situation, this is a good idea. In any other “plain” HTML situation, I fully agree with you that it’s a very silly idea indeed. Thankfully, like most things, it does have it’s place somewhere.

    Comment by Michael — February 20, 2008 @ 7:17 pm

Leave a comment

RSS feed for comments on this post. TrackBack URI

Search

Pages

Categories:

Recent Comments

Other Resources

Subscribe in NewsGator Online