0

I am writing an application which makes heavy use of some JavaScript inside of WebView.

I have a function inside of a String that allows me to download a PDF that works fine on my desktop enviornment as long as my popup blocker is disabled.

So I disabled the popup blocker as described in some other posts that I have found then loaded my HTML and JS using the following code.

String js = "....";
WebView myWebView = (WebView) findViewById(R.id.webview);
myWebView.getSettings().setAllowFileAccess(true);
myWebView.getSettings().setJavaScriptEnabled(true);
myWebView.getSettings().setSupportMultipleWindows(true);
myWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
myWebView.loadDataWithBaseURL("http://...", js, "text/html", "UTF-8", null);

Everything works fine except for my PDF.

I would expect to be give a new window, having allowed multiple windows and JavaScriptCanOpenWindowAutomatically.

Is there any other WebView setting I need to change to allow PDF's to be opened/viewed/downloaded?

Edit:

It should be noted that I am relying, for now, on whatever reader the user has on the system to take over the viewing of the PDF unless WebView has a built in way of viewing them.

Ananta Prasad
  • 3,655
  • 3
  • 23
  • 35
user3780616
  • 1,183
  • 1
  • 10
  • 23
  • possible duplicate of [How can I display a pdf document into a Webview?](http://stackoverflow.com/questions/2655972/how-can-i-display-a-pdf-document-into-a-webview) – Andrew T. Aug 14 '14 at 07:29
  • The main problem right now is that WebView isn't opening a new window. The exact same JS works fine on Chrome from my desktop as long as I have my popup blocker disabled. Is there a listener for new new windows I can implement to see if its even being triggered? – user3780616 Aug 14 '14 at 07:56

0 Answers0