Tutorial by Examples

This code simply navigates WebView to some Uri: this.webView.Navigate(new Uri("http://stackoverflow.com/")); or this.webView.Source = new Uri("http://stackoverflow.com/");
Set custom user agent and navigate to Uri: var userAgent = "my custom user agent"; var uri = new Uri("http://useragentstring.com/"); var requestMessage = new HttpRequestMessage(HttpMethod.Get, uri); requestMessage.Headers.Add("User-Agent", userAgent); this.webVie...
Show specified html string in WebView: var htmlString = @"<!DOCTYPE html> <html> <head><title>HTML document</title></head> <body> <p>This is simple HTML content.</p> </body>...
You can easily open a file from your app package, but Uri scheme must be "ms-appx-web" instead of "ms-appx": var uri = new Uri("ms-appx-web:///Assets/Html/html-sample.html"); this.webView.Navigate(uri);
To open a file from local folder or temp folder, target file must not be located in those folders' root. For security reasons, to prevent other content from being exposed by WebView, the file meant for displaying must be located in a subfolder: var uri = new Uri("ms-appdata:///local/html/html-...
In case when NavigateToString can't handle some content, use NavigateToLocalStreamUri method. It will force every locally-referenced URI inside the HTML page to call to the special resolver class, which can provide right content on the fly. Assets/Html/html-sample.html file: <!DOCTYPE html> ...

Page 1 of 1