【问题标题】:How to fix Links are not crawlable on Google Lighthouse如何修复在 Google Lighthouse 上无法抓取链接
【发布时间】:2021-05-21 01:07:17
【问题描述】:

我在运行 google lighthouse 时出错。警告是链接不可抓取。这是来自谷歌灯塔的警告。

<a href="https://www.mywebsite.com/en/test.html" id="multipleStore" target="popup" onclick="window.open('https://www.mywebsite.com/en/test.html','My popup windows open','resizable,height=480,width=875'); return false;">
                <p>click me</p>
            </a>

【问题讨论】:

    标签: javascript html lighthouse


    【解决方案1】:

    为防止 Google 抓取您的链接,请勿使用 URL,而是使用脚本。

    如果您使用类似这样的 Google Crawler(分别称为 Lighthouse)将忽略该链接:

    <a href="javascript:void(0)" onclick="openPopup()" class="link">click me</a>
    <script>
    function openPopup() {
        window.open('https://www.google.com/', 'Popup', 'width=400,height=875')
    }
    </script>
    

    示例:https://codepen.io/headstarterz/pen/eYgMaew

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-01-10
      • 2019-08-14
      • 2018-07-07
      • 1970-01-01
      • 1970-01-01
      • 2015-10-04
      • 1970-01-01
      相关资源
      最近更新 更多