http icon indicating copy to clipboard operation
http copied to clipboard

support for appendUserAgent feature in capacitor.config.json (iOS)

Open ldikmans opened this issue 3 years ago • 4 comments

Is your feature request related to a problem? Please describe. We want to use the appendUserAgent feature to add some specific information about our app to iOS apps.

Describe the solution you'd like Append the information from the capacitor configuration the user-agent information that is generated by the http plugin. When we don't use the plugin (Android), the information is correctly appended to the user-agent information.

Describe alternatives you've considered Sending it in the body, but then I have to add it to each request

Additional context See capacitor documentation

ldikmans avatar Jul 02 '21 16:07 ldikmans

@ldikmans how were you able to accomplish this in the body? Using HTTP.setHeader('*', 'User-Agent', ${navigator.userAgent} ${ua}); doesn't seem to work.

drewloomer avatar Jul 26 '21 14:07 drewloomer

@ldikmans how were you able to accomplish this in the body? Using HTTP.setHeader('*', 'User-Agent', ${navigator.userAgent} ${ua}); doesn't seem to work.

I was not planning to put it in the header, I meant just putting it in the body of the request (as data).

ldikmans avatar Jul 26 '21 22:07 ldikmans

it seems that in version 1.3 this is implemented so I guess you can close this enhancement request

ldikmans avatar Oct 26 '21 11:10 ldikmans

We upgraded to 1.4.1 In capacitor config you can append a user agent string. This works fine when not using the http plugin. When using the http plugin, this is ignored.

documentation

/**

  • String to append to the original user agent of Capacitor Web View.
  • This is disregarded if overrideUserAgent is used.
  • @since 1.4.0 */ appendUserAgent?: string;

ldikmans avatar Dec 14 '21 12:12 ldikmans