Skip to content

OHOS

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

Item Value
Package webview_all_ohos
Main platform class OhosWebViewPlatform
Controller OhosWebViewController
Widget OhosWebViewWidget
Navigation delegate OhosNavigationDelegate
Cookie manager OhosWebViewCookieManager
Engine ArkWeb
Minimum target OHOS 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,
);
API Purpose
OhosWebViewController.enableDebugging(bool enabled) Enables ArkWeb debugging globally.
webViewIdentifier Native 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.
Request Support
GET without headers Supported through ArkWeb loadUrl.
GET with headers Supported through ArkWeb loadUrl.
POST without custom headers Supported through ArkWeb postUrl.
POST with custom headers Not 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:

Type Meaning
OhosWebViewPermissionResourceType.midiSysex MIDI sysex.
OhosWebViewPermissionResourceType.protectedMediaId Protected 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:

Type Extra fields
OhosUrlChange isReload.
OhosWebResourceRequest isForMainFrame, isRedirect, hasGesture, method, headers.
OhosWebResourceResponse reasonPhrase, mimeType.
OhosPlatformSslAuthError url, 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.