javaScriptBridgeOriginAllowList property

Set<String>? javaScriptBridgeOriginAllowList
getter/setter pair

A Set of patterns that will be used to match the allowed origins where the JavaScript Bridge could be used. If pluginScriptsOriginAllowList is present, then this value will override it only for the JavaScript Bridge internal plugin. Adding '*' as an allowed origin or setting this to null, it means it will allow every origin. Instead, an empty Set will block every origin and, in this case, it will force the behaviour of the javaScriptBridgeEnabled parameter, as it was set to false.

NOTE: setting or changing this value after the WebView has been created won't have any effect. It should be set when initializing the WebView through PlatformWebViewCreationParams.initialSettings parameter.

NOTE for Android: each origin pattern MUST follow the table rule of PlatformInAppWebViewController.addWebMessageListener.

NOTE for iOS, macOS, Windows: each origin pattern will be used as a Regular Expression Pattern that will be used on JavaScript side using RegExp.

The default value is null and will allow every origin.

Officially Supported Platforms/Implementations:

  • Android WebView
  • iOS WKWebView
  • macOS WKWebView
  • Windows WebView2
  • Web <iframe> but requires same origin

Implementation

Set<String>? javaScriptBridgeOriginAllowList;