谷歌浏览器黄色警告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
Dreamweaver CC新版设置左右分栏的方法
Dreamweaver CC新版设置左右分栏的方法
2
MacOS系统中打开Adobe系列软件提示错误“Adobe Photoshop CC 2018 因为出现问题而无法打开”的解决方法
MacOS系统中打开Adobe系列软件提示错误“Adobe Photoshop CC 2018 因为出现问题而无法打开”的解决方法
3
electron开发中使用nodemon进行热更新的方法
electron开发中使用nodemon进行热更新的方法
4
Windows11系统cmd终端提示“命令提示符已被系统管理员停用”的一种可行解决方案
Windows11系统cmd终端提示“命令提示符已被系统管理员停用”的一种可行解决方案
5
神坑react native之react-navigation组件TabNavigator模式底部图标tabBarIcon不显示的解决方案
神坑react native之react-navigation组件TabNavigator模式底部图标tabBarIcon不显示的解决方案
最新评论
比比拉布
比比拉布
5月7日
太感谢了!!!!!!找了这么多的教程,只有你点出来了关键点——设计视图!!!!
Jake
Jake
3月7日
Halo 啊~麻烦更新下我的博客地址,原名:Jing Blog。麻烦更新如下: Jake Blog(后缀可以省略,也可以保留,看哪个风格适合) 网址:htt
评论于关于博主