initialUserScripts property

  1. @SupportedPlatforms.new(platforms: [AndroidPlatform(), IOSPlatform(note: """This property will be ignored if the [PlatformWebViewCreationParams.windowId] has been set. There isn't any way to add/remove user scripts specific to iOS window WebViews. This is a limitation of the native WebKit APIs."""), MacOSPlatform(note: """This property will be ignored if the [PlatformWebViewCreationParams.windowId] has been set. There isn't any way to add/remove user scripts specific to iOS window WebViews. This is a limitation of the native WebKit APIs."""), WindowsPlatform(), LinuxPlatform()])
UnmodifiableListView<UserScript>? get initialUserScripts

Initial list of user scripts to be loaded at start or end of a page loading. To add or remove user scripts, you have to use the InAppWebViewController's methods such as InAppWebViewController.addUserScript, InAppWebViewController.removeUserScript, InAppWebViewController.removeAllUserScripts, etc.

Officially Supported Platforms/Implementations:

  • Android WebView
  • iOS WKWebView:
    • This property will be ignored if the PlatformWebViewCreationParams.windowId has been set. There isn't any way to add/remove user scripts specific to iOS window WebViews. This is a limitation of the native WebKit APIs.
  • macOS WKWebView:
    • This property will be ignored if the PlatformWebViewCreationParams.windowId has been set. There isn't any way to add/remove user scripts specific to iOS window WebViews. This is a limitation of the native WebKit APIs.
  • Windows WebView2
  • Linux WPE WebKit

Use the PlatformInAppBrowser.isPropertySupported method to check if this property is supported at runtime.

Implementation

@SupportedPlatforms(
  platforms: [
    AndroidPlatform(),
    IOSPlatform(
      note:
          """This property will be ignored if the [PlatformWebViewCreationParams.windowId] has been set.
There isn't any way to add/remove user scripts specific to iOS window WebViews.
This is a limitation of the native WebKit APIs.""",
    ),
    MacOSPlatform(
      note:
          """This property will be ignored if the [PlatformWebViewCreationParams.windowId] has been set.
There isn't any way to add/remove user scripts specific to iOS window WebViews.
This is a limitation of the native WebKit APIs.""",
    ),
    WindowsPlatform(),
    LinuxPlatform(),
  ],
)
UnmodifiableListView<UserScript>? get initialUserScripts =>
    params.initialUserScripts;