Hi,
I started to create an Angular [5.2.3] application with Nativescript [3.4.1] (using TypeScript [2.6.2]). At the start I only had a WebView
for the native part of the app as I wanted to have a stable webapp first. Now I want to gradually use some angular components logic also on the native side with their dedicated native template so that in the long run I can get completely rid of the WebView
.
I have already the native counterpart of my menu that is currently used to change the src
of the WebView
but my problem is that the navigation within the WebView
by changing its source is very very slow (time of clicking on the menu button up to the page is loaded is 7sec).
After debugging my app, I found that the place where I was losing most of the time (>3/4 of the time) was between the WebView.loadStartedEvent
and the WebView.loadFinishedEvent
after having changed the src
of the WebView
simply like that:
private webView: WebView;
onMenuButtonTap(newUrl: string) {
this.webView.src = newUrl;
}
My question is therefore two fold:
- Is there another faster way to change the url of a
WebView
for navigation (triggered outside of theWebView
) than directly touching itssrc
property? - What is exactly happening between the
WebView.loadStartedEvent
and theWebView.loadFinishedEvent
that can take that much time when changing thesrc
property but that doesn’t have an impact while navigate in the webview as the user?
Webview Native Component
Android => android.webkit.WebView
iOS => WKWebView
Thank you in advance for any help you could provide me that could decrease this huge loading delay that I have.