I host maps. Each map has its own unique URL. But all these URLs return the exact same small HTML/CSS code, just to show something to the user while the assets and content are being loaded via Ajax.

Once loaded, the title and the content is updated.

However it seems Google isn't bothering with this:

I know Google crawlers run JavaScript, but not in this case? What are the possible reasons for this? And the possible solutions?

I have tested with the Search Console explorer. The page is rendered exactly as it should.

  • 1
    Have you tried the "fetch as Google" feature in Google Search Console? It has a "fetch and render" mode that can alert you to problems. Commented Mar 10, 2018 at 16:07
  • 1
    Indeed, I have tried it. It doesn't give any error and the result is as expected.
    – leyou
    Commented Mar 10, 2018 at 20:46

1 Answer 1


Google can crawl javascript, but it's not guaranteed that it will be able to read all types of javascript.

The meta tags of a page are loaded in the html, and Google reads this. There is no certainty that Google will change the meta tags based on your javascript.

The following code was reported to work in changing a site's meta tags while having Googlebot properly read it to update the SERP tags. I have personally not tested it.

  var m = document.createElement('meta'); 
  m.name = 'description'; 
  m.content = 'This tutorial has some helpful information for you, if you want to track how many hits come from browsers where JavaScript has been disabled.'; 

Another one:

document.title = "Google will run this JS and show the title in the search results!";

It is better if you can update the tags in PHP, but if you have to do it in JS you can try these out. If you do and they work, please do let me know as I might like to use this script later on as well.

  • 1
    I'm not doing the first thing (adding new meta elements) but I'm doing the second one (updating the document's title). And of course updating the body. I'm thinking it's probably because there's too much to load/it takes too long (about 2 seconds). So far that's the only explanation I have.
    – leyou
    Commented Mar 10, 2018 at 21:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.