Set user-agent in WebView for Android, API 30

做~自己de王妃 提交于 2020-07-10 07:30:00

问题


After reading android user agent I set in WebView:

webView.settings.apply {
    userAgentString = "some string"
    javaScriptEnabled = true
    javaScriptCanOpenWindowsAutomatically = true
    domStorageEnabled = true
}

And loaded the URL "https://www.whoishostingthis.com/tools/user-agent/". In emulators of API 21 and 29 it worked right. But in API 30 it showed:

How to change user-agent in API 30?


回答1:


According to https://www.infoq.com/news/2020/03/chrome-phasing-user-agent/, Chrome will replace User-Agent with a new API called Client Hints.



来源:https://stackoverflow.com/questions/62434410/set-user-agent-in-webview-for-android-api-30

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!