Skip to content
WebView AllWebView All
Documentation for version 1.2.x; select latest for up-to-date APIs.

OHOS

OHOS is provided by webview_all_ohos 1.2.1 and uses ArkWeb through the OHOS Flutter SDK.

ItemValue
Packagewebview_all_ohos
Main platform classOhosWebViewPlatform
ControllerOhosWebViewController
WidgetOhosWebViewWidget
Navigation delegateOhosNavigationDelegate
Cookie managerOhosWebViewCookieManager
EngineArkWeb
Minimum targetOHOS API 12+
final params = OhosWebViewControllerCreationParams(
isAllowFullScreenRotate: false,
domStorageEnabled: true,
javaScriptCanOpenWindowsAutomatically: true,
supportMultipleWindows: true,
loadWithOverviewMode: true,
useWideViewPort: true,
displayZoomControls: false,
builtInZoomControls: true,
allowFileAccess: true,
mediaPlaybackRequiresUserGesture: false,
supportZoom: true,
textZoom: 100,
);
APIPurpose
OhosWebViewController.enableDebugging(bool enabled)Enables ArkWeb debugging globally.
webViewIdentifierNative WebView instance identifier for interop.
setAllowFullScreenRotate(bool enabled)Controls fullscreen rotation behavior.
setDomStorageEnabled(bool enabled)Enables DOM storage.
setJavaScriptCanOpenWindowsAutomatically(bool enabled)Controls JavaScript popups.
setSupportMultipleWindows(bool support)Enables multiple window support.
setLoadWithOverviewMode(bool overview)Controls overview mode.
setUseWideViewPort(bool use)Enables wide viewport behavior.
setDisplayZoomControls(bool enabled)Shows or hides zoom controls.
setBuiltInZoomControls(bool enabled)Enables built-in zoom controls.
setAllowFileAccess(bool enabled)Controls file access.
setSupportZoom(bool support)Enables zoom support.
setMediaPlaybackRequiresUserGesture(bool require)Controls media autoplay policy.
setTextZoom(int textZoom)Sets text zoom percentage.
setOnShowFileSelector(callback)Handles file chooser requests.
setGeolocationPermissionsPromptCallbacks(...)Handles geolocation permission prompts.
setCustomWidgetCallbacks(...)Handles fullscreen custom views.
RequestSupport
GET without headersSupported through ArkWeb loadUrl.
GET with headersSupported through ArkWeb loadUrl.
POST without custom headersSupported through ArkWeb postUrl.
POST with custom headersNot supported. Throws UnsupportedError.

ArkWeb’s postUrl API accepts a URL and body data, but not a custom header map. webview_all_ohos fails explicitly so applications do not assume headers were sent.

OHOS supports common camera and microphone resources, plus:

TypeMeaning
OhosWebViewPermissionResourceType.midiSysexMIDI sysex.
OhosWebViewPermissionResourceType.protectedMediaIdProtected media identifier.
await (controller.platform as OhosWebViewController)
.setOnShowFileSelector((FileSelectorParams params) async {
return <String>['/data/storage/el2/base/files/upload.png'];
});
final cookieManager = WebViewCookieManager().platform
as OhosWebViewCookieManager;
await cookieManager.setAcceptThirdPartyCookies(
controller.platform as OhosWebViewController,
true,
);

OHOS-specific types add native request and response detail:

TypeExtra fields
OhosUrlChangeisReload.
OhosWebResourceRequestisForMainFrame, isRedirect, hasGesture, method, headers.
OhosWebResourceResponsereasonPhrase, mimeType.
OhosPlatformSslAuthErrorurl, errorCode, description, proceed(), cancel().
  • POST with custom headers is not available through current ArkWeb postUrl APIs.
  • Web content permission approval still requires the host app to hold the matching OHOS permission.
  • ArkWeb behavior can vary across HarmonyOS/OpenHarmony versions, especially for media, file picker, and permission surfaces. Test on the target API level.