阻止一行html出现在谷歌搜索中

Preventing a line of html from appearing in Google search

本文关键字:谷歌 搜索 html 一行      更新时间:2023-09-26

在我所有的html页面中,我有一段如下:

<p class="IE_Message">Please update your browser to enjoy the content of this website.</p>

这仅在用户使用IE 8或更低版本时显示。我的问题是,每当我在谷歌中搜索网站,并且我的搜索包含单词"网站"时,这一行就会出现在页面的描述中。

我试过这个:

<!--googleoff: index-->
    <p class="IE_Message">Please update your browser to enjoy the content of this website.</p>
<!--googleon: index-->

它不起作用。

有什么办法吗?

如何通过javascript加载文本?我确实试过这个:

$(document).ready(function(){
    $(".IE_Message").text("Please update your browser to enjoy the content of this website.");
});

但当我测试它时,文本没有显示。

如有任何帮助,我们将不胜感激。

谢谢。

您可以在此处使用条件注释。它不会出现在谷歌上。

<!--[if lt IE 9]>
    Please update your browser to enjoy the content of this website.
<![endif]-->