removeAllUserScripts method
- @SupportedPlatforms.new(platforms: [AndroidPlatform(), IOSPlatform(apiName: 'WKUserContentController.removeAllUserScripts', apiUrl: 'https://developer.apple.com/documentation/webkit/wkusercontentcontroller/1536540-removealluserscripts', note: "This method will throw an error if the [PlatformWebViewCreationParams.windowId] has been set. There isn't any way to add/remove user scripts specific to window WebViews. This is a limitation of the native WebKit APIs."), LinuxPlatform(apiName: 'webkit_user_content_manager_remove_all_scripts', apiUrl: 'https://wpewebkit.org/reference/stable/wpe-webkit-2.0/method.UserContentManager.remove_all_scripts.html'), MacOSPlatform(apiName: 'WKUserContentController.removeAllUserScripts', apiUrl: 'https://developer.apple.com/documentation/webkit/wkusercontentcontroller/1536540-removealluserscripts', note: "This method will throw an error if the [PlatformWebViewCreationParams.windowId] has been set. There isn't any way to add/remove user scripts specific to window WebViews. This is a limitation of the native WebKit APIs."), WebPlatform(), WindowsPlatform()])
Removes all the user scripts from the webpage’s content.
Officially Supported Platforms/Implementations:
- Android WebView
- iOS WKWebView (Official API - WKUserContentController.removeAllUserScripts):
- This method will throw an error if the PlatformWebViewCreationParams.windowId has been set. There isn't any way to add/remove user scripts specific to window WebViews. This is a limitation of the native WebKit APIs.
- Linux WPE WebKit (Official API - webkit_user_content_manager_remove_all_scripts)
- macOS WKWebView (Official API - WKUserContentController.removeAllUserScripts):
- This method will throw an error if the PlatformWebViewCreationParams.windowId has been set. There isn't any way to add/remove user scripts specific to window WebViews. This is a limitation of the native WebKit APIs.
- Web <iframe> but requires same origin
- Windows WebView2
Use the PlatformInAppWebViewController.isMethodSupported method to check if this method is supported at runtime.
Implementation
@SupportedPlatforms(
platforms: [
AndroidPlatform(),
IOSPlatform(
apiName: 'WKUserContentController.removeAllUserScripts',
apiUrl:
'https://developer.apple.com/documentation/webkit/wkusercontentcontroller/1536540-removealluserscripts',
note:
"This method will throw an error if the [PlatformWebViewCreationParams.windowId] has been set. There isn't any way to add/remove user scripts specific to window WebViews. This is a limitation of the native WebKit APIs.",
),
LinuxPlatform(
apiName: 'webkit_user_content_manager_remove_all_scripts',
apiUrl:
'https://wpewebkit.org/reference/stable/wpe-webkit-2.0/method.UserContentManager.remove_all_scripts.html',
),
MacOSPlatform(
apiName: 'WKUserContentController.removeAllUserScripts',
apiUrl:
'https://developer.apple.com/documentation/webkit/wkusercontentcontroller/1536540-removealluserscripts',
note:
"This method will throw an error if the [PlatformWebViewCreationParams.windowId] has been set. There isn't any way to add/remove user scripts specific to window WebViews. This is a limitation of the native WebKit APIs.",
),
WebPlatform(),
WindowsPlatform(),
],
)
Future<void> removeAllUserScripts() {
throw UnimplementedError(
'${PlatformInAppWebViewControllerMethod.removeAllUserScripts.name} is not implemented on the current platform',
);
}