Plugin for Cordova 3.0+ that allows you to change your User-Agent for HTTP requests.
https://www.whoishostingthis.com/tools/user-agent/
Starting from Build.VERSION_CODES.KITKAT Android version, changing the user-agent while loading a web page causes WebView to initiate loading once again. https://developer.android.com/reference/android/webkit/WebSettings#setUserAgentString(java.lang.String)
https://stackoverflow.com/questions/62434410/set-user-agent-in-webview-for-android-api-30/62535531
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.
To install the plugin, use the Cordova CLI and enter the following:
cordova plugin add https://github.com/LouisT/cordova-useragent
- Android
- iOS (9+, with WKWebView plugin)
To set your User-Agent:
UserAgent.set(useragent)
To get your current User-Agent:
UserAgent.get(function(ua) { })
To set your User-Agent back to the default:
UserAgent.reset()