谷歌浏览器黄色警告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
MacOS系统中打开Adobe系列软件提示错误“Adobe Photoshop CC 2018 因为出现问题而无法打开”的解决方法
MacOS系统中打开Adobe系列软件提示错误“Adobe Photoshop CC 2018 因为出现问题而无法打开”的解决方法
2
利用fastcopy神器快速批量删除大量文件的方法
利用fastcopy神器快速批量删除大量文件的方法
3
快看,那个学前端的上吊了
快看,那个学前端的上吊了
4
老孙谈“师德”-最近一些热点事件引发的思考
老孙谈“师德”-最近一些热点事件引发的思考
5
腾讯视频平台下载方法,专属QLV格式文件无损快速提取MP4文件的方法
腾讯视频平台下载方法,专属QLV格式文件无损快速提取MP4文件的方法
最新评论
比比拉布
比比拉布
5月7日
太感谢了!!!!!!找了这么多的教程,只有你点出来了关键点——设计视图!!!!
Jake
Jake
3月7日
Halo 啊~麻烦更新下我的博客地址,原名:Jing Blog。麻烦更新如下: Jake Blog(后缀可以省略,也可以保留,看哪个风格适合) 网址:htt
评论于关于博主