You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
funcnavigatorTest() {
chromePath, found:=launcher.LookPath()
if!found {
panic("chrome not found")
}
u:=launcher.New().
Headless(false).
Bin(chromePath).
Leakless(true).
MustLaunch()
browser:=rod.New().NoDefaultDevice().ControlURL(u).MustConnect()
deferbrowser.MustClose()
userAgentOptions:=&proto.NetworkSetUserAgentOverride{
UserAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
Platform: "MacIntel",
}
page:=browser.MustPage("")
err:=page.SetUserAgent(userAgentOptions)
iferr!=nil {
panic(err)
}
page.MustNavigate("https://example.com/")
utils.Sleep(20) //Check navigator.platform in consolepage.MustNavigate("https://google.com/")
utils.Sleep(20) //Check navigator.platform in console
}
What you got
navigator.platform value in chrome dev console reverts from MacIntel to Win32 with the second page navigation.
What you expected to see
The value of all navigator properties to stay the same when navigating in the same page context.
The navigator.useragent property doesn't change after the navigation to the second site in this same code.
I am not sure if this is expected behavior when working with changing pages?
The text was updated successfully, but these errors were encountered:
I think my issue was due chrome devtools. The overridden navigator.platform property was preserved during navigation as long as DevTools isn't opened. When I open it (even if I dont run any commands), the navigator.platform reverts back when the page navigates to a new URL.
Maybe it resets the value when attaching the debugging session?
No issues when checking navigator with:
Rod Version: v0.113.4
The code to demonstrate your question
What you got
navigator.platform value in chrome dev console reverts from MacIntel to Win32 with the second page navigation.
What you expected to see
The value of all navigator properties to stay the same when navigating in the same page context.
The navigator.useragent property doesn't change after the navigation to the second site in this same code.
I am not sure if this is expected behavior when working with changing pages?
The text was updated successfully, but these errors were encountered: