title: Images not displaying in Android WebView
body: <p>I have a situation where I am trying to display user-generated HTML in a <code>webview</code> using <code>loadData</code>. My code is something like this:</p>
  
  <pre><code>String content = "&lt;?xml version=\"1.0\" encoding=\"UTF-8\" ?&gt;" +
      "&lt;html&gt;&lt;head&gt;" +
      "&lt;meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" /&gt;" +
      "&lt;/head&gt;&lt;body&gt;";
  content += htmlStr + "&lt;/body&gt;&lt;/html&gt;";
  wv.loadData(content, "text/html", "UTF-8");
  </code></pre>
  
  <p>It works pretty well in most cases, but I am having trouble getting certain types of images to display. In most of my testing, inserting <code>&lt;img src="..."/&gt;</code> tags worked fine, but I found that links to images on Photobucket would not display at all; I get a little box with question mark in it instead of the image. </p>
  
  <p>Clicking on a link to an image on Photobucket tends to take you to the page on which that image is viewable on their website, rather than just the raw image itself. I have a feeling that the issue is related to this. I suspect that it may be a "Referer" issue, or perhaps user-agent, or something of that nature, but I cannot for the life of me get this to display properly. </p>
  
  <p>I have tried switching to <code>loadDataWithBaseURL</code> and providing a <code>BaseURL</code> (as I believe this will be used as the referer url) but that made no difference. I have also tried using <code>loadUrl("http://photobucket..."</code> instead and providing a <code>HashMap</code> with the Referer header manually set, but that did not work either. Actually, switching to <code>loadUrl</code> made it immediately redirect to the device's browser to load the Photobucket page. I attempted to provide a custom <code>WebViewClient</code> and override <code>shouldOverrideUrlLoading</code>, but the best I got it to do was to display the full Photobucket page inside the <code>WebView</code>.</p>
  
  <p>I am sure this is not a specific issue with Photobucket, that just happens to be the site that I discovered this problem with while I was testing. </p>
  
  <p>I would really like to figure some way to deal with this situation so that this can work correctly, but I have been as yet unable to find any helpful direction on SO or the internet at large. Does anyone have any ideas?</p>