Skip to content
Documentation for 0.2.0. Check your installed version and the migration guide.

Methods ​

Call these methods on the NitroWebViewType received through hybridRef={callback(...)}.

MethodReturnBehavior
goBack()voidGo back in history.
goForward()voidGo forward in history.
reload()voidReload the current page.
stopLoading()voidStop loading; iOS also cancels pending navigation decisions and a source waiting for shared-cookie import.
evaluateJavaScript(code: string)Promise<string>JSON text. Parse once. iOS rejects evaluation/serialization errors; Android page exceptions can look like null.
injectJavaScript(code: string)voidSide effect only. No result or completion signal.
postMessage(data: string)voidDispatch a page message once. iOS window; Android document.
getCookies(url: string)Promise<Cookie[]>Absolute HTTP(S) URL. iOS selected store; Android name/value only.
setCookie(url: string, cookie: Cookie)Promise<void>Write to the selected store. Expiry in milliseconds.
clearCookies()Promise<void>Remove every cookie in the store, including other origins/views sharing it.
clearCache()Promise<void>Resource cache only. Preserves cookies, DOM storage, and history.
clearHistory()Promise<void>Android clears past/forward entries except the current page. iOS no-op.
requestFocus()Promise<void>Request native focus. Resolution is not proof of DOM input focus.

Lifecycle and failures ​

After Android renderer exit, old void calls do nothing and old Promise calls reject with NitroWebViewState. Remount on retry and capture a new ref. Cookie/cache work already submitted to the platform can still complete.

After iOS unmount, store methods reject rather than falling back to a default store.

Read JavaScript, cookies and sessions, and troubleshooting.

MIT licensed · Built with Nitro Modules