proyecto26 / react-native-inappbrowser

📱InAppBrowser for React Native (Android & iOS) 🤘
https://www.npmjs.com/package/react-native-inappbrowser-reborn
MIT License
1.32k stars 224 forks source link

How can I append a user-agent? #362

Closed StuartPyper closed 2 years ago

StuartPyper commented 2 years ago

I want to be able to detect user by a custom user-agent.

In a webview I can add "applicationNameForUserAgent="xxx"" and it will append "xxx" to the end of the user-agent. How can I do similar with react-native-inappbrowser?

I have tried adding it via the headers option but I can't seem to get it to work using the key/value pairs.

Thanks.

StuartPyper commented 2 years ago

It seems this is not possible on iOS and on Android only CORS-safelisted request headers are allowed: https://developer.mozilla.org/en-US/docs/Glossary/CORS-safelisted_request_header. This is a shame but it seems there is nothing react-native-inappbrowser will be able to do to get around it. Back to a WebView I go ;(