Forum Xamarin.Forms

Reset WebView in OnDisappearing

jb_tcjb_tc USMember ✭✭
edited December 2017 in Xamarin.Forms


this question is specially for iOS in xamarin forms.

I have an TabBar. In every TabBar is an webview. If I switch to the third tab, and back to the first again the Event "OnDisappearing" is called.
Now I want to change the webview content (of the third tab) if the "OnDisappearing" event is called.

I tried to to this:

protected override void OnDisappearing()
     var htmlSource = new HtmlWebViewSource();
     htmlSource.Html = @"<html><body></body></html>";
     browserView.Source = htmlSource;


But if I go again from the first to the third tab, there is no empty page, there is the last open URL again.

So what I specially want: If I leave the third tab, the WebView Content should be empty, clean - with no content. So if I go again to that tab, there should no "old" page visible.
How can I do that? Is there any way? Why does my way not work?


Best Answer


Sign In or Register to comment.