【问题标题】:Preventing a line of html from appearing in Google search防止一行 html 出现在 Google 搜索中
【发布时间】:2014-10-11 12:21:22
【问题描述】:

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

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

这仅在用户使用 IE 8 或更低版本时显示。我的问题是,每当我在 google 中搜索该网站时,如果我的搜索包含“网站”一词,该行就会显示在页面描述中。

我试过了:

<!--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.");
});

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

对此的任何帮助表示赞赏。

谢谢。

【问题讨论】:

  • 您是否考虑过使用条件 cmets (&lt;!--[if lt IE 9]&gt; HTML here &lt;![endif]--&gt;)?由于其他浏览器将它们解释为 HTML cmets,它们(可能)不应该出现在 Google 中。显示的条件注释将隐藏每个浏览器的内容,除了那些低于 (lt) IE 9 的 Internet Explorer 版本。
  • Look here(Felix Kling 的回答可能适合您的需要)
  • 我已经使用了条件语句,但该行仍然出现在描述中?
  • 考虑删除文本。它不会为您的网站增加任何价值,并且或多或少是对由于公司政策而无法更新浏览器的用户的侮辱。如果您仍然觉得有必要给出这样的“建议”,请使用 JavaScript 添加它。在这样的简单案例中几乎不需要 jQuery。不要指望这种变化很快就会在谷歌中得到体现。他们可能需要几个月的时间才能决定重新索引页面。

标签: javascript html indexing search-engine


【解决方案1】:

您可以在此处使用条件 cmets。它不会出现在 google 中。

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

【讨论】:

  • if lt IE 9 将是 OP 正在寻找的。​​span>
  • 我已经使用了条件语句,但该行仍然出现在描述中?
  • 谷歌缓存描述还是什么?我什至从每一页中删除了该行,它仍然显示?
  • 使用&lt;meta name="description" content="A description of the page" /&gt;。所以,这个文本只会显示在谷歌描述中。
  • @Forrest :是的,Google 可能会缓存描述。请稍后检查。
猜你喜欢
  • 2019-11-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多