繁体   English   中英

IE11渲染/加载图标晚于其他浏览器

[英]IE11 rendering /loading icons late as compared to other browser

我正在使用Angular 5应用程序,并在整个站点中使用SVG图标。 在Chrome,Mozilla和Safari等常规浏览器中,图标可以正确加载,但在IE11中,图标无法加载。

为此,我在pollyfill.ts文件中添加了svgxuse https://github.com/Keyamoon/svgxuse

进行此更改后,所有图标现在都已加载到IE11浏览器中,但加载时间很晚。 我的意思是,将所有内容加载到屏幕上大约需要1-2秒。

从用户角度来看这不是很好。 有谁知道如何在IE浏览器中预加载/快速加载这些图标。

提前致谢。

我认为您不能做太多..也许尝试一下服务工作者(我不知道他们是否在IE11中工作)..使用Service worker您可以加载和缓存图像和资产...

类似于:(在您的ngsw-config.js文件中)

{
  "index": "/index.html",
  "assetGroups": [{
    "name": "app",
    "installMode": "prefetch",
    "resources": {
      "files": [
        "/favicon.ico",
        "/index.html"
      ],
      "versionedFiles": [
        "/*.bundle.css",
        "/*.bundle.js",
        "/*.chunk.js"
      ]
    }
  }, {
    "name": "assets",
    "installMode": "lazy",
    "updateMode": "prefetch",
    "resources": {
      "files": [
        "/assets/**"
      ]
    }
  }]
}

然后在您的angular.cli.json文件中设置:

"serviceWorker": true

希望对您有帮助!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM