Skip to content

Commit

Permalink
Merge pull request #63 from hotwired/document-applicationUserAgentPrefix
Browse files Browse the repository at this point in the history
Document `applicationUserAgentPrefix`
  • Loading branch information
jayohms authored Dec 18, 2024
2 parents 0382c06 + aaef4d5 commit 1e034a8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 5 additions & 2 deletions _source/android/05_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,11 @@ Set the JSON converter used for bridge components:
Hotwire.config.jsonConverter = KotlinXJsonConverter()
```

Customize the user agent:
Set a custom user agent application prefix for every `WebView` instance. The library will automatically append a substring to your prefix which includes:
* - `"Hotwire Native Android; Turbo Native Android;"` - for `hotwire_native_app?` on your [Rails server](https://github.com/hotwired/turbo-rails/blob/1aa7ba9d38dee1e1b4078a74404131122b907176/app/controllers/turbo/native/navigation.rb#L14)
* - `"bridge-components: [your bridge components];"`
* - The `WebView`'s default Chromium user agent string

```kotlin
Hotwire.config.userAgent = "My Application; ${Hotwire.config.userAgentSubstring()}"
Hotwire.config.applicationUserAgentPrefix = "My Application;"
```
5 changes: 4 additions & 1 deletion _source/ios/05_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ Hotwire Native provides a few options to customize your iOS app. We recommend ma
## General

* `Hotwire.config.debugLoggingEnabled` - Enable or disable debug logging for Turbo visits and bridge elements connecting, disconnecting, receiving/sending messages, and more.
* `Hotwire.config.userAgent` - Override to set a custom user agent for your app's requests. Make sure to include "Hotwire Native" or "Turbo Native" to use `turbo_native_app?` on your [Rails server](https://github.com/hotwired/turbo-rails/blob/1aa7ba9d38dee1e1b4078a74404131122b907176/app/controllers/turbo/native/navigation.rb#L14).
* `Hotwire.config.applicationUserAgentPrefix` - Set a custom user agent application prefix for every `WKWebView` instance. The library will automatically append a substring to your prefix which includes:
* `"Hotwire Native iOS; Turbo Native iOS;"` - for `hotwire_native_app?` on your [Rails server](https://github.com/hotwired/turbo-rails/blob/1aa7ba9d38dee1e1b4078a74404131122b907176/app/controllers/turbo/native/navigation.rb#L14)
* `"bridge-components: [your bridge components];"`
* `WKWebView`'s default user agent string (at the beginning of the user agent)
* `Hotwire.config.showDoneButtonOnModals` - When enabled, adds a `UIBarButtonItem` of type `.done` to the left navigation bar button item on screens presented modally.
* `Hotwire.config.backButtonDisplayMode` - Sets the back button display mode of `HotwireWebViewController`.

Expand Down

0 comments on commit 1e034a8

Please sign in to comment.