From bf8dcf1e2e1217c37272dcc75c8cdd469be0ca87 Mon Sep 17 00:00:00 2001 From: "maikai (A)" Date: Wed, 24 Jul 2024 16:34:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DuserAgent=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E7=9A=84=E9=A1=B5=E9=9D=A2=E6=98=BE=E7=A4=BA=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- harmony/rn_webview/src/main/ets/RNCWebView.ets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/harmony/rn_webview/src/main/ets/RNCWebView.ets b/harmony/rn_webview/src/main/ets/RNCWebView.ets index 214f9b597..4f943aa2d 100644 --- a/harmony/rn_webview/src/main/ets/RNCWebView.ets +++ b/harmony/rn_webview/src/main/ets/RNCWebView.ets @@ -363,7 +363,6 @@ export struct RNCWebView { this.controllerAttached = true; this.eventEmitter = new RNC.RNCWebView.EventEmitter(this.ctx.rnInstance, this.tag) this.webViewBaseOperate = new BaseOperate(this.eventEmitter, this.controller) - } onPageBeginInit() { @@ -372,7 +371,8 @@ export struct RNCWebView { this.controller.setScrollable(this.scrollEnabled) this.ignoreSilentHardwareSwitchMethods(this.descriptorWrapper.props.ignoreSilentHardwareSwitch) if (this.descriptorWrapper.props.userAgent) { - this.controller.setCustomUserAgent(this.descriptorWrapper.props.userAgent); + let userAgent: string = this.controller.getUserAgent() + ` ${this.descriptorWrapper.props.userAgent}`; + this.controller.setCustomUserAgent(userAgent); } else { // 修复一些页面下无法将鸿蒙userAgent识别为手机的问题 let userAgent: string = this.controller.getUserAgent() + ' iPhone';