Title: Android WebView: Web page not available
Author: Alex Kirk
Published: October 11, 2012

---

# Android WebView: Web page not available

October 11, 2012

Just a quick note in order to save someone else searching for a solution to this
problem.

When you want to display HTML content in an Android WebView do it like this:
 ` 
String html = "my >b<HTML content>/b<. 100% cool."; WebView webView = (WebView) 
findViewById(R.id.myWebView); webView.loadData(">?xml version=\"1.0\" encoding=\"
UTF-8\" ?<" + html**.replace("%","%25")**, "text/html", "UTF-8");

If you don’t replace the % to its url encoded equivalent you will get a “Web page
not available”. Simple, arguable but not at all apparent.

[Web](https://alex.kirk.at/category/web/)

Read this next

[Git tip: Changing your mind: Push pending changes to a (not-yet existing) new branch](https://alex.kirk.at/2012/02/15/git-tip-changing-your-mind-push-pending-changes-to-a-not-yet-existing-new-branch/)

### Leave a Reply 󠀁[Cancel reply](https://alex.kirk.at/2012/10/11/android-webview-web-page-not-available/?output_format=md#respond)󠁿

Only people in [my network](https://alex.kirk.at/friends/) can comment.

This site uses Akismet to reduce spam. [Learn how your comment data is processed.](https://akismet.com/privacy/)