添加的元标记未被 metatagscheck.com 选中
Added meta tags not picked up by metatagscheck.com
我在 head
标签的顶部添加了 title
和 description
元标签。页面加载后,我可以看到源页面中添加的元标记。
然而,当我使用 http://www.metatagscheck.com/ 检查它时,标签不存在。
<script type='text/javascript'>
var title=document.createElement('meta');
title.name="title";
title.content="Wholesale Prices of Manufacture, Distributors, Traders, Suppliers for GCC & Africa";
var description=document.createElement('meta');
description.name="description";
description.content="Find quality products over the world to get it at your place in GCC and Africa sourced through Manufacturers, Suppliers, Wholesalers, from the UAE, India, China, Turkey, Europe and US.";
document.head.insertBefore(description, document.head.firstElementChild);
document.head.insertBefore(title, document.head.firstElementChild);
</script>
工具 http://www.metatagscheck.com/ likely¹ doesn’t execute JavaScript on the page it tests. This is common for many tools (example: W3C’s HTML5 validator).
如果您将元标记作为 HTML 添加到文档中(而不是通过 JavaScript 添加),该工具应该能够读取它们。就像它确实阅读了 title
²。
¹这里只能猜测,因为它的源代码似乎没有公开。
² title
元素不同于 meta
-title
元素。一个meta
-title
element is invalid in HTML5 (it isn’t registered,所以不允许使用。
我在 head
标签的顶部添加了 title
和 description
元标签。页面加载后,我可以看到源页面中添加的元标记。
然而,当我使用 http://www.metatagscheck.com/ 检查它时,标签不存在。
<script type='text/javascript'>
var title=document.createElement('meta');
title.name="title";
title.content="Wholesale Prices of Manufacture, Distributors, Traders, Suppliers for GCC & Africa";
var description=document.createElement('meta');
description.name="description";
description.content="Find quality products over the world to get it at your place in GCC and Africa sourced through Manufacturers, Suppliers, Wholesalers, from the UAE, India, China, Turkey, Europe and US.";
document.head.insertBefore(description, document.head.firstElementChild);
document.head.insertBefore(title, document.head.firstElementChild);
</script>
工具 http://www.metatagscheck.com/ likely¹ doesn’t execute JavaScript on the page it tests. This is common for many tools (example: W3C’s HTML5 validator).
如果您将元标记作为 HTML 添加到文档中(而不是通过 JavaScript 添加),该工具应该能够读取它们。就像它确实阅读了 title
²。
¹这里只能猜测,因为它的源代码似乎没有公开。
² title
元素不同于 meta
-title
元素。一个meta
-title
element is invalid in HTML5 (it isn’t registered,所以不允许使用。