I'm trying to load a website in a WebView
and it loads the source code just fine. However i cannot seem to get it to render the website, instead it displays the source code.
I've tried to change the content-type of the returning response on the server-side but no matter what type is indicated only text/plain seems to work in the actual WebView (the WebView disregards the content-type, if I dump the response text/html is indeed implied).
Here is my code;
HashMap<String, String> headers = new HashMap<String, String>();
headers.put("Authorization", "Basic " + Base64.encodeToString((Application.getInstance().getUserName() + ":" + Application.getInstance().getUserPassword()).getBytes(), Base64.NO_WRAP));
String url = getIntent().getStringExtra("url");
WebView webView = ((WebView) findViewById(R.id.ledger_webview));
webView.getSettings().setJavaScriptEnabled(true);
webView.clearCache(true);
webView.loadUrl(url, headers);
From what I can tell other people use the same method, I've also looked in the manual which basically says to do the steps I'm doing, but obviously I'm missing something here.
Do I need to pass a flag somewhere, or manually indicate the content-type for the WebView?
Edit: This is the response headers from the server
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Length: 2559
Content-Type: text/html