Sites won’t load if a domain user agent is set that is different than the current user agent.
For example, dr.dk.
#1 Updated by Soren Stoutner over 1 year ago
- Subject changed from Some sites won't load if the default WebView user agent is used. to Sites won't load if a domain user agent is set that is different than the default user agent.
This bug actually appears to be caused if the user agent in the domain settings is different than the default user agent. Likely what is happening is that the user agent is being set by domain settings, causing a refresh and reloading the current domain.
#5 Updated by Soren Stoutner over 1 year ago
The fix for this bug causes a new user agent to not be applied if a website is currently loading. Domain settings are set before the load begins, so if a website has a domain specified user agent, it will be applied before the load begins. But if the website then redirects to a URL that has specified a different user agent, this second user agent will not be applied. Also, if the user presses back while a website is loading, the user agent of the loading website will still be applied irrespective of the specified user agent of the website that is being returned to.
The fixes for these problems would be complex because of deficiencies in the controls provided by Android’s `WebView`. After the website finishes the correct user agent could be applied, but tracking that would be complex. Alternately, we could apply the user agent on every page finish (there might be some bugs to doing this, I haven’t looked at it closely enough). In either case, in the above scenarios, the web server would see a connection from one user agent and then a second connection from the other user agent, which isn’t a real good solution.
A permanent solution after the fork of Privacy WebView would be to modify `WebView’s` behavior to make it more intelligent about switching user agents when loading websites, but those types of changes would be deep and require a lot of maintenance. I’m not sure it would be worth the effort.
#6 Updated by Soren Stoutner over 1 year ago
- Status changed from New to Closed
#9 Updated by Soren Stoutner 1 day ago
- Status changed from In Progress to Closed
The solution ends up being a whole lot more complex than simply delaying the loading of the URL, but I think that now in all circumstances, when a refresh is forced by the changing of the user agent, the target URL will then be manually loaded afterwared.