@nativescript-community/ui-webview-root
    Preparing search index...

    Class AWebView

    Represents a standard WebView widget.

    Hierarchy (View Summary)

    Indexable

    • [key: symbol]: (...args: any[]) => any
    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    Properties

    autoInjectJavaScriptBlocks: InjectExecuteJavaScript[]

    List of code blocks to be executed after JS-files and CSS-files have been loaded.

    autoInjectJSBridge: boolean

    Auto Inject WebView JavaScript Bridge on load finished? Defaults to true.

    autoInjectScriptFiles: LoadJavaScriptResource[]

    List of js-files to be auto injected on load finished

    autoInjectStyleSheetFiles: LoadStyleSheetResource[]

    List of css-files to be auto injected on load finished

    builtInZoomControls: boolean

    Android: Is the built-in zoom mechanisms being used

    cacheMode: "default" | "no_cache" | "cache_first" | "cache_only"
    databaseStorage: boolean

    Android: Enable/Disabled database storage API. Note: It affects all webviews in the process.

    debugMode: boolean

    Android: Enable/disable debug-mode

    displayZoomControls: boolean

    Android: displays on-screen zoom controls when using the built-in zoom mechanisms

    domStorage: boolean

    Android: Enable/Disabled DOM Storage API. E.g localStorage

    injectBridge: boolean

    Whether to install event bridge

    injectPolyfills: boolean

    Whether to install promise polyfill

    nestedScrollView: boolean

    ANDROID: should the webview support nested scroll. Default to true

    Note: This can break some web views like maps pinch to zoom.

    scrollBarIndicatorVisible: boolean
    scrollBounce: boolean

    iOS: Should the scrollView bounce? Defaults to true.

    src: string

    Gets or sets the url, local file path or HTML string.

    supportPopups: boolean
    supportXLocalScheme: boolean
    supportZoom: boolean

    Android: should the webview support zoom

    tempSuspendSrcLoading: boolean

    Prevent this.src loading changes from the webview's onLoadFinished-event

    viewPortSize: ViewPortValue

    Set viewport metadata for the webview. Set to false to disable.

    Note: WkWebView defaults initial-scale=1.0.

    webConsoleEnabled: boolean
    webRTC: boolean
    isFetchSupported: boolean

    Is Fetch API supported?

    Note: Android's Native Fetch API needs to be replaced with the polyfill.

    isPromiseSupported: boolean

    Does this platform's WebView support promises?

    supportXLocalScheme: boolean

    Accessors

    • get canGoBack(): boolean

      Gets a value indicating whether the WebView can navigate back.

      Returns boolean

    • get canGoForward(): boolean

      Gets a value indicating whether the WebView can navigate forward.

      Returns boolean

    • get interceptScheme(): string

      Returns string

    • get enterFullscreenEvent(): EventNames

      Returns EventNames

    • get exitFullscreenEvent(): EventNames

      Returns EventNames

    • get loadFinishedEvent(): EventNames

      String value used when hooking to loadFinished event.

      Returns EventNames

    • get loadProgressEvent(): EventNames

      Returns EventNames

    • get loadStartedEvent(): EventNames

      String value used when hooking to loadStarted event.

      Returns EventNames

    • get requestPermissionsEvent(): EventNames

      Returns EventNames

    • get shouldOverrideUrlLoadingEvent(): EventNames

      String value used when hooking to shouldOverrideUrlLoading event

      Returns EventNames

    • get titleChangedEvent(): EventNames

      Returns EventNames

    • get webAlertEvent(): EventNames

      Returns EventNames

    • get webConfirmEvent(): EventNames

      Returns EventNames

    • get webConsoleEvent(): EventNames

      Returns EventNames

    • get webPromptEvent(): EventNames

      Returns EventNames

    Methods

    • Platform specific loadData-implementation.

      Parameters

      • src: string

      Returns void

    • Parameters

      • progress: number

      Returns void

    • Platform specific loadURL-implementation.

      Parameters

      • src: string

      Returns void

    • Parameters

      • exitFullscreen: () => void

      Returns boolean

    • Callback for onLoadStarted-event from the native webview

      Parameters

      • url: string

        URL being loaded

      • OptionalnavigationType: NavigationType

        Type of navigation (iOS-only)

      Returns void

    • Parameters

      • permissions: any

      Returns Promise<false | void>

    • Callback for should override url loading. Called from the native-webview

      Parameters

      • url: string
      • httpMethod: string

        GET, POST etc

      • OptionalnavigationType: NavigationType

        Type of navigation (iOS-only)

      Returns boolean

    • Parameters

      • title: string

      Returns void

    • Parameters

      • message: string
      • callback: () => void

      Returns boolean

    • Parameters

      • message: string
      • callback: (response: boolean) => void

      Returns boolean

    • Parameters

      • message: string
      • lineNo: number
      • level: string

      Returns boolean

    • Parameters

      • message: string
      • defaultText: string
      • callback: (response: string) => void

      Returns boolean

    • Parameters

      • scriptCode: string
      • name: string

      Returns void

    • Auto-load a JavaScript-file after the page have been loaded.

      Parameters

      • resourceName: string
      • filepath: string

      Returns void

    • Auto-load a stylesheet-file after the page have been loaded.

      Parameters

      • resourceName: string
      • filepath: string
      • OptionalinsertBefore: boolean

      Returns void

    • Emit event into the webview.

      Parameters

      • eventName: string
      • data: any

      Returns void

    • Execute JavaScript inside the webview. The code should be wrapped inside an anonymous-function. Larger scripts should be injected with loadJavaScriptFile. NOTE: stringifyResult only applies on iOS.

      Type Parameters

      • T

      Parameters

      • scriptCode: string
      • OptionalstringifyResult: boolean

      Returns Promise<T>

    • Execute a promise inside the webview and wait for it to resolve. Note: The scriptCode must return a promise.

      Type Parameters

      • T

      Parameters

      • scriptCode: string
      • Optionaltimeout: number

      Returns Promise<T>

    • Type Parameters

      • T

      Parameters

      • scriptCodes: string[]
      • Optionaltimeout: number

      Returns Promise<void | T>

    • Helper function, strips 'x-local://' from a resource name

      Parameters

      • resourceName: string

      Returns string

    • Generate script code for loading CSS-file.generateLoadCSSFileScriptCode

      Parameters

      • resourceName: string
      • path: string
      • OptionalinsertBefore: boolean

      Returns Promise<string>

    • Generate script code for loading javascript-file.

      Parameters

      • resourceName: string
      • path: string

      Returns Promise<string>

    • Resolve a "x-local://{name}" to file-path.

      Parameters

      • name: string

      Returns string | void

    • Get document.title NOTE: On Android, if empty returns filename

      Returns Promise<string | void>

    • Navigates back.

      Returns any

    • Navigates forward.

      Returns any

    • Inject WebView JavaScript Bridge.

      Returns Promise<void>

    • Load a JavaScript file on the current page in the webview.

      Parameters

      • scriptName: string
      • filepath: string

      Returns Promise<void>

    • Load a stylesheet file on the current page in the webview.

      Parameters

      • stylesheetName: string
      • filepath: string
      • OptionalinsertBefore: boolean

      Returns Promise<void>

    • Called from delegate on webview event. Triggered by: window.nsWebViewBridge.emit(eventName: string, data: any); inside the webview

      Parameters

      • eventName: string
      • data: any

      Returns void

    • Convert response from WebView into usable JS-type.

      Parameters

      • result: any

      Returns any

    • Register a local resource. This resource can be loaded via "x-local://{name}" inside the webview

      Parameters

      • name: string
      • filepath: string

      Returns void

    • Reloads the current url.

      Returns any

    • Parameters

      • filepath: string

      Returns string | void

    • Stops loading the current content (if any).

      Returns any

    • Unregister a local resource.

      Parameters

      • name: string

      Returns void

    • Parameters

      • message: string
      • Optionaltype: number

      Returns void

    • Parameters

      • zoomFactor: number

      Returns any

    • Returns boolean

    • Returns boolean