1. 设置UserAgent
一定要使用applicationNameForUserAgent 这个属性设置,不要使用userAgent 属性,否则会不生效或者引起未知bug
// 6.0.0 之前版本
InAppWebView(
initialOptions: InAppWebViewGroupOptions(
crossPlatform:
InAppWebViewOptions(applicationNameForUserAgent: "QYAppName"),
),
)
// 6.0.0以后版本
InAppWebView(
initialSettings: InAppWebViewSettings(
applicationNameForUserAgent: "QYAppName",
// 不要使用这个userAgent属性设置,否则会有各种未知的bug userAgent = ""
),
)