Webview reloads when coming back on the page
See original GitHub issueI have a NativeScript Page (i.e. main page) that contains an WebView and means to navigate to another NativeScript Page (i.e. about page).
If I got to the about page, and then come back to the main page, on android only, the webview on the main page will reload with the initial URL.
The fact that on iOS it works as expected leads me to believe itβs a bug.
I have this problem on two different applications that Iβm working on now, and I also found another guy on StackOverflow with the same issue. If it is needed, I will also write a small example app that will illustrate the issue.
Iβm using {N} with vanilla JS.
$ tns info
All NativeScript components versions information
ββββββββββββββββββββ¬ββββββββββββββββββ¬βββββββββββββββββ¬βββββββββββββββββββ
β Component β Current version β Latest version β Information β
β nativescript β 3.1.2 β 3.1.3 β Update available β
β tns-core-modules β 3.1.0 β 3.1.0 β Up to date β
β tns-android β 3.1.1 β 3.1.1 β Up to date β
β tns-ios β 3.1.0 β 3.1.0 β Up to date β
ββββββββββββββββββββ΄ββββββββββββββββββ΄βββββββββββββββββ΄βββββββββββββββββββ
Issue Analytics
- State:
- Created 6 years ago
- Comments:13 (11 by maintainers)
Top Results From Across the Web
Android Webview - Prevent Reload When Go Back to the App
How to prevent reload on webview when your back to the app? When tapping home key and then back to the app, the...
Read more >WebView - Android Developers
Transportation object for returning WebView across thread boundaries. ... Gets whether the page can go back or forward the given number of steps....
Read more >WebView - React Native
Go back one page in the web view's history. reload() β. reload();.
Read more >location.reload() - Web APIs | MDN
The location.reload() method reloads the current URL, like the Refresh button.
Read more >Reset React Native WebView to initial url - Medium
return ( <WebView ref={r => this.webview = r} source={{ uri: yourInitialUrl }} /> ); } }. Ok, but if the user navigated X...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@surdu I think you can use
npm i tns-core-modules@next --saveinstead oftns plugin add.Hi @surdu, Thank you for your further investigation. Indeed while setting the value for the src property inline in the XML the WebView page will be reloaded every time, when you navigate back to the previous page. This is caused due to fact that the native WebView will be destroyed and recreated every time when you navigate to the page with WebView.
However, this behavior has been fixed in @next modules and you could test it on your side while following the described steps:
tns plugin remove tns-core-modulestns plugin add tns-core-modules@nextalso before rebuild delete
node_modulesandplatformsfolders