Hi,
I am seeing one strange issue for PDF download in webview:If I Override
shouldOverrideUrlLoading() for webview client then PDF file is not getting downloaded for embedded URL in webview.
But without its working fine.I am overriding above method to avoid authentication page pop up within same webview for embedded URL when user click it on this.
Can you please let me know how to resolve this issue:I have posted code below for both scenraios.
Thanks in advance..
Case I code below (able to download pdf file):
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.titledetails);
Bundle bundle = getIntent().getExtras();
String body = bundle.getString("title");
webview = (WebView) findViewById(R.id.webview);
webview.getSettings().setJavaScriptEnabled(true);
//webview.l
webview.loadDataWithBaseURL(null, body, "text/html", "utf-8","");
}
Case 2 (not able to download pdf file)
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.titledetails);
Bundle bundle = getIntent().getExtras();
String body = bundle.getString("title");
webview = (WebView) findViewById(R.id.webview);
webview.setWebChromeClient(chromeClient);
webview.setWebViewClient(wvClient);
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setPluginsEnabled(true);
webview.setWebViewClient(new WebViewClient()
{
// @Override
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
view.loadUrl(url);
return true;
}
});
webview.getSettings().setJavaScriptEnabled(true);
webview.loadDataWithBaseURL(null, body, "text/html", "utf-8","");
}
PS.As I did not get any response reposting same thread...
Thanks,
Amy
I am seeing one strange issue for PDF download in webview:If I Override
shouldOverrideUrlLoading() for webview client then PDF file is not getting downloaded for embedded URL in webview.
But without its working fine.I am overriding above method to avoid authentication page pop up within same webview for embedded URL when user click it on this.
Can you please let me know how to resolve this issue:I have posted code below for both scenraios.
Thanks in advance..
Case I code below (able to download pdf file):
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.titledetails);
Bundle bundle = getIntent().getExtras();
String body = bundle.getString("title");
webview = (WebView) findViewById(R.id.webview);
webview.getSettings().setJavaScriptEnabled(true);
//webview.l
webview.loadDataWithBaseURL(null, body, "text/html", "utf-8","");
}
Case 2 (not able to download pdf file)
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.titledetails);
Bundle bundle = getIntent().getExtras();
String body = bundle.getString("title");
webview = (WebView) findViewById(R.id.webview);
webview.setWebChromeClient(chromeClient);
webview.setWebViewClient(wvClient);
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setPluginsEnabled(true);
webview.setWebViewClient(new WebViewClient()
{
// @Override
public boolean shouldOverrideUrlLoading(WebView view, String url)
{
view.loadUrl(url);
return true;
}
});
webview.getSettings().setJavaScriptEnabled(true);
webview.loadDataWithBaseURL(null, body, "text/html", "utf-8","");
}
PS.As I did not get any response reposting same thread...
Thanks,
Amy