谷歌浏览器黄色警告Fetching scripts with an invalid type/language attributes is deprecated and will be removed in M56…的解决方案

在站点中如果使用es6语法的模块化module写法,在某些谷歌浏览器中解析执行的时候没有效果,并有黄色警告提醒:

Fetching scripts with an invalid type/language attributes is deprecated and will be removed in M56, around January 2017. See https://www.chromestatus.com/features/5760718284521472 for more details.

警告中提到了 https://www.chromestatus.com/features/5760718284521472 这个地址,这是谷歌官方的错误提示:

Deprecate all fetches for scripts with invalid type/language attributes

Right now, the preload scanner will send fetches for script tags regardless of type/language, but the script will not execute when parsed. Often, sites will use these custom tags combined with XHR, resulting in double downloads. By deprecating the fetch, the preload scanner and the parser will have the same semantics, and we will not be initiating fetches for scripts we will not execute. To work around this issue and maintain the fetch, sites should use link preload.

 

大意就是script标签不支持当前设置的type属性(因为es6中的module模块化需要设置script标签type=’module’属性)。其实这个问题也简单,说白了,就是你当前用的浏览器版本太低了,下载个最新的官方版谷歌浏览器就行了。

这里也要注意,目前一些国产浏览器(360安全浏览器、搜狗浏览器、腾讯QQ浏览器等)集成的谷歌内核版本都较低,尽量别用这些浏览器做测试。

 

 

 

 

关于博主
骨灰级博客玩家
国内第一批90后网站站长/程序员
做过七年前端讲师
目前从事锦鲤观赏鱼电商行业
鱼贝贝锦鲤创始人
文章列表
1
JavaScript中数学对象Math抽取随机数的公式详解
JavaScript中数学对象Math抽取随机数的公式详解
2
PNG格式图片转INCS格式苹果图标文件的方法
PNG格式图片转INCS格式苹果图标文件的方法
3
老生常谈之CSS背景background-clip与background-origin属性的特点和区别
老生常谈之CSS背景background-clip与background-origin属性的特点和区别
4
Discuz论坛程序X3.4修改标题限制80字限制的方法详解
Discuz论坛程序X3.4修改标题限制80字限制的方法详解
5
【推荐】Clover - windows系统中优秀的资源管理器扩展软件
【推荐】Clover - windows系统中优秀的资源管理器扩展软件
最新评论
比比拉布
比比拉布
5月7日
太感谢了!!!!!!找了这么多的教程,只有你点出来了关键点——设计视图!!!!
Jake
Jake
3月7日
Halo 啊~麻烦更新下我的博客地址,原名:Jing Blog。麻烦更新如下: Jake Blog(后缀可以省略,也可以保留,看哪个风格适合) 网址:htt
评论于关于博主