【问题标题】:Preload images with link tag - remove warning (html/Javascript)预加载带有链接标签的图片 - 删除警告 (html/Javascript)
【发布时间】:2022-06-21 16:11:17
【问题描述】:

当我尝试将<link rel="preload" as="image" href="path"> 添加到<head> 时,我在控制台上收到以下警告。

{path to image} was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally

我尝试添加 crossorigin="anonymous" 属性,但警告仍然存在。

请告诉我如何删除警告?

【问题讨论】:

    标签: javascript html angular typescript console


    【解决方案1】:

    如果相关图片不是页面内容的一部分,就会发生这种情况。如果实际图像在页面本身上,则不会显示此警告。如果浏览器在页面上没有找到图像,但它是预加载的,您会收到此警告。

    【讨论】:

      猜你喜欢
      • 2015-02-23
      • 2019-04-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-06-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多