My Android app can display files sent as raw HTML in a web view.
Generally there are no issues, but a user is sending the following and all i am getting is a blank white page.
<!doctype html>
<html>
<head></head>
<body>
<script type='text/javascript'>
window.location.href = "http://www.pdf995.com/samples/pdf.pdf";
</script>
</body>
</html>
and i cannot get the webview to load the file in the script.
I have all of the following enabled to try to get javascript to work:
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setDomStorageEnabled(true);
webview.getSettings().setLoadWithOverviewMode(true);
webview.getSettings().setUseWideViewPort(true);
webview.getSettings().setBuiltInZoomControls(true);
webview.getSettings().setDisplayZoomControls(false);
webview.getSettings().setSupportZoom(true);
webview.getSettings().setDefaultTextEncodingName("utf-8");
webview.getSettings().setPluginState(WebSettings.PluginState.ON);
and i have used both of these loadData calls to no avail (not using both at the same time, just included to show what i've tried):
webview.loadDataWithBaseURL("", documentHtml.htmlRaw, "text/html", "utf-8", "");
webview.loadData(htmlRaw, "text/html", "utf-8");
When i create a .html document containing the above html, email it and open it on my Android device, it gives me the choice to use Android HTML Viewer or Chrome/Internet (Android browser)...when i use the HTML Viewer i get the same blank white page that i see in my app...when i use Chrome/Internet it allows me to download the file and then view it.
The file will not always necessarily be a PDF file, but no matter what i want to be able to either:
Preferably display the document in the app without having to download it first
Download the document to my devices Downloads folder, and then view it.
Any help/suggestions would be great.