zoukankan      html  css  js  c++  java
  • polyfill.io 试用

    Polyfill 可以为旧浏览器提供和标准 API 一样的功能。比如你想要 IE 浏览器实现 Promise 和 fetch 功能,你需要手动引入 es6-promise、whatwg-fetch。而通过 Polyfill.io,你只需要引入一个 JS 文件。

    <script src="https://cdn.polyfill.io/v2/polyfill.min.js"></script>

    Polyfill.io 通过分析请求头信息中的 UserAgent 实现自动加载浏览器所需的 polyfills。 Polyfill.io 有一份默认功能列表,包括了最常见的 polyfills:document.querySelector、Element.classList、ES5 新增的 Array 方法、Date.now、ES6 中的 Object.assign、Promise 等。

    <!DOCTYPE html>
    <html lang="en">
    <head> 
    <meta charset="UTF-8"> 
    <title>Document</title>     
    <script src="https://cdn.polyfill.io/v2/polyfill.min.js?callback=main" async defer></script> 
    <script>  
    function main(){            
      var node=document.createElement("script");
      node.src="index.js";             
      document.body.appendChild(node);   
    }     
    </script> 
    </head>
    <body> 
    </body> 
    </html>

    参考链接:https://www.jianshu.com/p/3e0bf9a414e3

  • 相关阅读:
    Form表单提交数据的几种方式
    前端基础-HTML
    python入门函数详解
    Python作业编写
    Python入门数据类型详解
    Jquery选择器
    做外链接和有外链接区别
    三层架构
    drop,delete,truncate区别
    run()和star()区别
  • 原文地址:https://www.cnblogs.com/pengxiangchong/p/11647128.html
Copyright © 2011-2022 走看看