Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setFakeUA、initFirstAccessMobileDetecting 的优化 #258

Open
VecHK opened this issue Aug 2, 2023 · 0 comments
Open

setFakeUA、initFirstAccessMobileDetecting 的优化 #258

VecHK opened this issue Aug 2, 2023 · 0 comments
Labels
documentation Improvements or additions to documentation improve
Milestone

Comments

@VecHK
Copy link
Owner

VecHK commented Aug 2, 2023

Poker 里有两种 UA 伪装的实现,分别是 initFirstAccessMobileDetecting 和 setFakeUA。

从技术上来说,setFakeUA 没有弄MOBILE_PAGE_IDENTIFIER这样的东西破坏原来的 URL,是利用 chrome.declarativeNetRequest 匹配 tabID 来设定 UA 伪装的,肯定是更好。

但 setFakeUA 并没有取代 initFirstAccessMobileDetecting。因为 setFakeUA 必须要先创建了 tab 后才能运行,所以这时候还得用 initFirstAccessMobileDetecting 来做 UA 伪装,以实现首次打开搜索窗口也能做到 UA 伪装。

其实应该是能解决的,我想了个思路。那就是先创建一个中转页面,进入中转页面等待一下子,把 setFakeUA 运行起来,然后中转页面再跳转到目标页里……可能唯一要考虑到应该只是 referrer 的问题吧?

也不一定需要中转页面,Chrome 的 API 直接就能跳转了:chrome.tabs.update(tabid, { url: 'xxx' })

这样取代了 initFirstAccessMobileDetecting 之后,多出来的唯一一个麻烦应该是历史记录吧

@VecHK VecHK added the improve label Aug 2, 2023
@VecHK VecHK added this to the 2.X milestone Aug 2, 2023
@VecHK VecHK added the documentation Improvements or additions to documentation label Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation improve
Projects
None yet
Development

No branches or pull requests

1 participant