瀏覽代碼

Fix embedded Zoom web client by using a Safari user agent.

WKWebView’s default UA triggers Zoom’s unsupported-browser page on host start links; set a desktop Safari string so new meetings load in the right panel.

Co-authored-by: Cursor <cursoragent@cursor.com>
huzaifahayat12 2 月之前
父節點
當前提交
c077416f03
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      zoom_app/ViewController.swift

+ 5 - 0
zoom_app/ViewController.swift

@@ -21,6 +21,10 @@ private enum AppWindowMetrics {
     static let defaultContentHeight: CGFloat = 690
 }
 
+/// Zoom shows "browser not supported" for the default macOS `WKWebView` UA. Use a desktop Safari string so join/start (including `/s/` host links) load in-app.
+private let embeddedZoomWebViewUserAgent =
+    "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Safari/605.1.15"
+
 /// Errors from the main-window embedded OAuth web session (right panel).
 private enum EmbeddedOAuthFlowError: Error {
     case webViewUnavailable
@@ -6548,6 +6552,7 @@ class ViewController: NSViewController {
         let embeddedBrowserConfiguration = WKWebViewConfiguration()
         embeddedBrowserConfiguration.preferences.javaScriptCanOpenWindowsAutomatically = true
         let embeddedWK = WKWebView(frame: .zero, configuration: embeddedBrowserConfiguration)
+        embeddedWK.customUserAgent = embeddedZoomWebViewUserAgent
         embeddedWK.translatesAutoresizingMaskIntoConstraints = false
         embeddedWK.setContentCompressionResistancePriority(.init(1), for: .horizontal)
         embeddedWK.setContentHuggingPriority(.init(1), for: .horizontal)