0

Trying to load a local HTML file into webview in my native-script (typescript) application. It's not loading but shows an error.

<WebView src="~/assets/content.html" />

The requested URL was not found on this server.

1
  • @AshishKamble This is for android right? My case here is on NativeScript. Commented Aug 29, 2019 at 6:31

1 Answer 1

0

You have to pass the absolute URL or you can try the following.

import * as fs from "tns-core-modules/file-system";
public webViewSRC: string = encodeURI(`${fs.knownFolders.currentApp().path}/assets/content.html`);

and in your html

<WebView [src]="webViewSRC"></WebView>
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.