Open cameronc56 opened 4 years ago
It appears the user-agent-overrides get set "onPageCreated". Is there something we could change this to to make it cover both page creations and navigations?
set_user_agent() {
this.page.on('framenavigated', () => {
this.page._client.send('Network.setUserAgentOverride', { userAgent: this.user_agent.toString(),
acceptLanguage: 'en-US,en', platform: this.user_agent.data.platform });
});
};
this worked for me. it is not set upon launch (you just get a blank page anyways), but it sets it after any page navigations. it would be nice if the plugin could do this too
Hey @cameronc56
Seems a nice fix, i would just send that as a pull request :), but unfortunately @berstend has been MIA (and i really hope he's okay) so your pull request would probably be a tad "stale" :(
I honestly wouldn't mind to maintain this library since i use it daily for various projects i have, but for now, it is what it is :)
Repro steps:
open console. type window.navigator.platform and window.navigator.userAgent. Notice they are set to the values you passed into UserAgentOverride correctly.
navigate to a page. repeat step 2. notice it is still set
navigate to a different page. repeat step 2. notice window.navigator.platform gets reset to the system value. Further navigations do not set it back to the override value.
I have tried this with many different combinations of pages, and it always seems to get unset on the second navigation.