diff --git a/README.md b/README.md index db998bd..b05fb9d 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ The `tabs` field is an array of objects with the following fields: | `customCss` | Array of Strings (Optional) | Custom CSS URLs (see [Custom JS/CSS](#custom-jscss)) | | `basicAuthUser` | String (Optional) | User name credential for requests that use basic access authentication | | `basicAuthPassword` | String (Optional) | Password credential for requests that use basic access authentication | -| `userAgent` | String (Optional) | Override the user agent header (Defaults to a recent Safari value) | +| `userAgent` | String (Optional) | Override the default WebKit user agent header | Here's the bare minimum example used in the Slack demo video above: diff --git a/Sources/Runtime/Config.swift b/Sources/Runtime/Config.swift index 2f48508..cec7609 100644 --- a/Sources/Runtime/Config.swift +++ b/Sources/Runtime/Config.swift @@ -43,7 +43,7 @@ struct Config { customJs: tab.customJs ?? [], basicAuthUser: tab.basicAuthUser ?? "", basicAuthPassword: tab.basicAuthPassword ?? "", - userAgent: tab.userAgent ?? "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15" + userAgent: tab.userAgent )} }() diff --git a/Sources/Runtime/Tab.swift b/Sources/Runtime/Tab.swift index 00a05e7..dfc99e2 100644 --- a/Sources/Runtime/Tab.swift +++ b/Sources/Runtime/Tab.swift @@ -13,7 +13,7 @@ class Tab: NSObject { // Also: https://stackoverflow.com/a/64012633 var badgeCount: Int = 0 - init(title: String, url: URL, customCss: [URL], customJs: [URL], basicAuthUser: String, basicAuthPassword: String, userAgent: String) { + init(title: String, url: URL, customCss: [URL], customJs: [URL], basicAuthUser: String, basicAuthPassword: String, userAgent: String?) { let configuration = WKWebViewConfiguration() Browser.global.customCss(configuration, urls: customCss) Browser.global.customJs(configuration, urls: customJs)