[Deprecation] Resource requests whose URLs contained both removed whitespace (`\n`, `\r`, `\t`) char

最近改一个网站的功能,在本地测试的时候都是好的,但是在服务器上线后,整个页面的目录结构就乱了。具体的说就是,本来应该是子级元素的,却和父级元素同级了,导致了整个页面很乱。

具体的报错信息如下:[Deprecation] Resource requests whose URLs contained both removed whitespace (`\n`, `\r`, `\t`) characters and less-than characters (`<`) are blocked. Please remove newlines and encode less-than characters from places like element attribute values in order to load these resources. See https://www.chromestatus.com/feature/5735596811091968 for more details.

[Deprecation] Resource requests whose URLs contained both removed whitespace (`\n`, `\r`, `\t`) char

看字面意思是说,有这么几个特殊字符(`\n`, `\r`, `\t`),导致小于符号被block了。我以为是要把网页里的所有tab换成4个空格就好了,结果发现并不是这个原因。

打开这个网页,显示如下:

[Deprecation] Resource requests whose URLs contained both removed whitespace (`\n`, `\r`, `\t`) char

这下就发现问题所在,意思就是,如果标签语言不完整,比如<img>这个标签,如果只有<img,而没有>,这就不完整了,会导致某些网页的攻击。

后来仔细检查了下网页结构,把错误排查后。页面就恢复正常了。