Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <a class="thirdbox" href="/media/wysiwyg/pdf/systemaufbau-anleitungen.pdf" target="_blank" download="blizz-z_Systemaufbau_Anleitungen" title="Datei downloaden">
- <div class="iconlink">
- <p>Systemaufbau Anwendungsbroschüre<br><span style="font-size: 75%;">(PDF 5,8 MB)</span></p>
- </div>
- </a>
- myWebView.setWebViewClient(new WebViewClient() {
- ...
- // Give the host application a chance to take control when a URL is about to be loaded in the current WebView.
- @Override
- public boolean shouldOverrideUrlLoading(WebView view, String url)
- {
- Log.i("debug_log", "shouldOverrideUrlLoading");
- // Allow download of .pdf files
- if (url.endsWith(".pdf")) {
- startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
- // if want to download pdf manually create AsyncTask here
- // and download file
- return true;
- }
- // Allow URL's starting with /
- if (url.startsWith("/")) {
- startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(website + url)));
- // if want to download pdf manually create AsyncTask here
- // and download file
- return true;
- }
- // Also allow urls not starting with http or https (e.g. tel, mailto, ...)
- if( URLUtil.isNetworkUrl(url) ) {
- return false;
- } else {
- startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
- }
- return true;
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement