I\'ve been trying to figure out a way to get a local webpage content to load and set the webview html content in native script. I\'ve successfully got it working on the sim
Here is an example how to add WebView src
from local file. In the example has been shown the both cases with nativescript-webview-interface
plugin and without it. ~/
returns the path to your app
folder.
main-page.xml
main-page.ts
import { EventData } from 'data/observable';
import { Page } from 'ui/page';
import { HelloWorldModel } from './main-view-model';
var webViewInterfaceModule = require("nativescript-webview-interface");
import {WebView} from "ui/web-view";
var oWebViewInterface;
export function onLoaded(args: EventData) {
let page = args.object;
var webView:WebView = page.getViewById('WebViewId');
oWebViewInterface = new webViewInterfaceModule.WebViewInterface(webView, '~/index.html');
var SecondWebView:WebView = page.getViewById('WebViewId2');
SecondWebView.src="~/secondpage.html"
page.bindingContext = new HelloWorldModel();
}