Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. <a class="thirdbox" href="/media/wysiwyg/pdf/systemaufbau-anleitungen.pdf" target="_blank" download="blizz-z_Systemaufbau_Anleitungen" title="Datei downloaden">
  2. <div class="iconlink">
  3. <p>Systemaufbau Anwendungsbroschüre<br><span style="font-size: 75%;">(PDF 5,8 MB)</span></p>
  4. </div>
  5. </a>
  6.  
  7. myWebView.setWebViewClient(new WebViewClient() {
  8.  
  9. ...
  10.  
  11. // Give the host application a chance to take control when a URL is about to be loaded in the current WebView.
  12. @Override
  13. public boolean shouldOverrideUrlLoading(WebView view, String url)
  14. {
  15. Log.i("debug_log", "shouldOverrideUrlLoading");
  16.  
  17. // Allow download of .pdf files
  18. if (url.endsWith(".pdf")) {
  19. startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
  20. // if want to download pdf manually create AsyncTask here
  21. // and download file
  22. return true;
  23. }
  24.  
  25. // Allow URL's starting with /
  26. if (url.startsWith("/")) {
  27. startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(website + url)));
  28. // if want to download pdf manually create AsyncTask here
  29. // and download file
  30. return true;
  31. }
  32.  
  33. // Also allow urls not starting with http or https (e.g. tel, mailto, ...)
  34. if( URLUtil.isNetworkUrl(url) ) {
  35. return false;
  36. } else {
  37. startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
  38. }
  39.  
  40. return true;
  41. }
  42.  
  43. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement