简体   繁体   中英

google considers html meta tag created with javascript?

Suppose i have following code in body element

Will google serach bot consider this meta tag for search optimization?

var a=document.createElement("meta");

a.setAttribute("name","description");

a.setAttribute("content","Test website");

var b=document.getElementsByTagName("head")[0];

b.appendChild(a);

Not without you having to change some of the code in your site. This page explains what you have to do to make AJAX pages crawlable .

No, it won't. Indexing robots do not execute JavaScript code that they find on web pages. In most cases, that would be pointless (the code has been written to run in a browser environment), and it would waste resources.

Some day some search engine may start executing some part of JavaScript code that they find, if the designers of the search engine think they have a good reason to do so. Based on past experience, the reason would probably be an attempt to detect and defeat tricks that some web page designers use in order to fool search engines using JavaScript.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM