Closed jperdereau closed 3 years ago
@jperdereau Are you facing this issue while using this plugin in your app or without the plugin as well?
I do not have the issue without the plugin.
Same for me. UA is wrong on an iOS Cordova app using this plugin. I'm using an iPhone X on iOS 14.4 with cordova-ios 6.2.0.
This will break my analytics in order to known with browsers / operating system are visiting my web app.
@jperdereau Can you share a sample app to demonstrate the issue.
Here https://github.com/jperdereau/sample_issue_cordova-plugin-wkwebview-file-xhr
Here the Readme to install https://github.com/jperdereau/sample_issue_cordova-plugin-wkwebview-file-xhr/blob/master/Readme.md
The first commit is without the plugin
The second commit just add the plugin
Any news on your side?
Hi @jperdereau , We will be sharing the update on this issue by this week end.
@jperdereau Following response is being fetched from the server. At the plugin end we are not processing the response and modifying it. What I understand is that you must be creating this response at server end and passing it back to client. You need to provide us the client property which is being used by your server to generate "ua" object having 'rawUa' key. Otherwise I don't see any override from plugin to modify the incoming response.
meta: {name: "useragent", repo: "https://github.com/3rd-Eden/useragent", version: "2.2.1"}
os: {string: Object, family: "Other", major: "0", minor: "0", patch: "0"}
ua: {rawUa: "HelloCordova/1.0.0 CFNetwork/1206 Darwin/19.6.0", family: "CFNetwork", major: "0", minor: "0", patch: "0", …}
Hello,
Not sure I understand.
The sample app is full client, it just fetch from https://www.whatsmyua.info/api/v1/ua https://github.com/jperdereau/sample_issue_cordova-plugin-wkwebview-file-xhr/blob/master/www/js/index.js#L44
https://www.whatsmyua.info/ is not mine, just a website to know your UA.
@jperdereau Since this is a 3rd part api to check UA we cannot comment how exactly they are fetching the UA information from app. Have you tried yourself in your app to fetch the user agent instead of using a 3rd part website?
Indeed I have the issue on analytics and another microservice that we are calling from the client app.
Indeed I have the issue on analytics and another microservice that we are calling from the client app.
@jperdereau My query was, have you tried fetching the user agent without using mentioned 3rd party website. If yes can you let me know how you achieved that?
Closing the issue due to inactivity.
Well the issue is on a fetch, I need to fetch or xhr something, I can create a small node server on the side that show the UA but the issue will be the same. Checking on the app before sending as no point because the change is done by the native request too me.
This issue still needs to be open. my server requires the use of the user agent set in the config.xml this plugin overrides it
This plugin is great but this issue not solved until today I got useragent like @jperdereau not full useragent this plugin not updated, please @oracle fixed this issue Thanks
please check reqContext.requestHeaders
with <preference name="NativeXHRLogging" value="full" />
. if reqContext.requestHeaders['User-Agent']
is not there, add it to xhr-polyfill.js line 604 like reqContext.requestHeaders['User-Agent'] = navigator.userAgent;
before creating reqPayload
.
xCode Version 12.4 (12D4e) Simulator on iPad 8th gen iOS 14.4 cordova: "10.0.0" cordova-ios: "6.1.1"
Using
XHR
orwindow.fetch
on https://www.whatsmyua.info/api/v1/ua you get a UA like "YOUR_APP/1 CFNetwork/1220.1 Darwin/20.3.0"Using the Cordova config to override and append is not working anymore https://cordova.apache.org/docs/en/10.x/config_ref/index.html
OverrideUserAgent(string) AppendUserAgent(string)