raginggoat
raginggoat

Reputation: 3600

Access Response Headers in Web View

I have a web view that has some links to some PDFs. How can I load these files for viewing? Currently, I have this open my default browser, but this won't work since the user doesn't have an active session in the browser. Ideally I'd be able to open the PDF in my web view.

public boolean shouldOverrideUrlLoading(WebView view, String url)
            {
               if (url.endsWith("/doc_show/")) {
                    try {
                        Uri uriUrl = Uri.parse(url);
                        Intent intentUrl = new Intent(Intent.ACTION_VIEW, uriUrl);
                        startActivity(intentUrl);
                        return true;
                    } catch (Exception e) {
                        Toast.makeText(getActivity(), "Can't Open", Toast.LENGTH_LONG).show();
                    }
                }

                return false;
            }

This is the URL and header info:

enter image description here

Upvotes: 2

Views: 902

Answers (1)

Montwell
Montwell

Reputation: 555

I believe your only option is to download the file using HttpUrlConnection with your session attached. Then call the intent on the local file.

Upvotes: 1

Related Questions