F9y4ng / GreasyFork-Scripts

The open source code of this project is used for userscripts (油猴脚本) for desktop browsers, including Font Rendering (Customized) (字体渲染(自用脚本)- Font Rendering.user.js), and Search Engine Assistant (优雅的搜索引擎助手 - Google & Baidu Switcher.user.js), etc.
https://f9y4ng.github.io/GreasyFork-Scripts/
GNU General Public License v3.0
954 stars 46 forks source link

[发现错误] 进入B站时,更改浏览器UA为Safari后字体渲染功能失效 #70

Closed westjmoon closed 2 years ago

westjmoon commented 2 years ago

描述错误信息
进入B站时,更改浏览器UA为Safari后字体渲染功能失效

错误再现

  1. _去B站网址 “www.bilibili.com”
  2. 使用浏览器扩展“User Agent Switcher and Manager”更换UA为Safari 14.1(Mozilla/5.0 (Macintosh; Intel Mac OS X 11_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1 Safari/605.1.15) 3.更换UA后刷新B站页面,页面字体渲染功能失效

预期结果
希望可以兼容在切换浏览器UA的情况下使用

屏幕截图 (如果适用,请添加屏幕截图以帮助解释您的问题) 未切换UA时渲染效果图: 未切换UA

切换UA后页面显示效果图: 切换UA

客户端信息:

请预先排除与你本地其他扩展或脚本的冲突,尽量在仅运行本脚本的情况下测试

F9y4ng commented 2 years ago

这并非代码的bug,因为Font Rendering (Customized)的代码已对BLINK内核平台启用了最新的navigator.userAgentData来取代navigator.userAgent。Chromium 101版本开始将全面启用navigator.userAgentData,这是大势所趋。

User Agent Switcher and Manager 插件无法更改navigator.userAgentData数据,强制修改会使程序报错。

你所遇到的这个错误会在下次版本更新时做简单的兼容处理(脚本运行不报错),但不保证功能的完整性,因为Font Rendering (Customized)脚本对浏览器navigator.userAgentData的数据读取是功能应用的重要依据。

F9y4ng commented 2 years ago

version 2022.03.19.1 should be fixed.