title: Android:Open iframe of WebView in Browser/YouTube App
body: <p>I have some JSON content of a blog which i am displaying using <code>loadDataWithBaseURL</code> in <code>WebView</code>. Many articles of this blog have embedded youtube/vimeo videos. </p>
  
  <p>Currently, all the videos are played inside the webview itself.</p>
  
  <p>What i want to achieve is, when the user clicks to Play the Video, he should get the popup "Complete Action Using" Browser or YouTube App. In short, i dont want the videos to be played inside the webview of app.</p>
  
  <p>I found questions where everyone was trying to avoid this popup.. Dont' know why i am not getting it.</p>
  
  <p>Here is my code </p>
  
  <pre><code>public class DetailFragment extends Fragment {
  
      String strTitle = null;
      String strURL = null;
      String strContent = null;
  
      @Override
      public void onActivityCreated(Bundle savedInstanceState) {
  
          super.onActivityCreated(savedInstanceState);
          setHasOptionsMenu(true);
          AdView mAdView = (AdView) getView().findViewById(R.id.adView);
          AdRequest adRequest = new AdRequest.Builder().build();
          mAdView.loadAd(adRequest);
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  
          View view = inflater.inflate(R.layout.detail_fragment, container, false);
  
          strTitle = getArguments().getString("title");
          strURL = getArguments().getString("url");
          strContent = getArguments().getString("content");
  
          String contToDisplay = "&lt;html&gt;&lt;head&gt;&lt;meta http-equiv='Content-Type' content='text/html' charset='UTF-8' /&gt;&lt;/head&gt;&lt;body&gt;&lt;style type='text/css'&gt; img{width:80%;} .wp-image-42223{display:none;}&lt;/style&gt;" + strContent+"&lt;/body&gt;&lt;/html&gt;";
  
          TextView title = (TextView) view.findViewById(R.id.title);
          WebView desc = (WebView) view.findViewById(R.id.desc);
  
  
          WebSettings ws = desc.getSettings();
          ws.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
          ws.setJavaScriptEnabled(true);
          ws.setLoadWithOverviewMode(true);
          ws.setUseWideViewPort(true);
          ws.setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
  
          ws.setUserAgentString("Mozilla/5.0 (Linux; U; Android 2.0; en-us; Droid Build/ESD20) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17");
          title.setText(strTitle);
          // desc.loadData(contToDisplay, "text/html; charset=UTF-8", null);
          desc.loadDataWithBaseURL("about:blank",strContent,"text/html", "UTF-8", null);
  
          return view;
      }
  }
  </code></pre>
  
  <p>any solution that wold make the videos load in browser or YouTube App would help.</p>
  
  <p><strong>NOTE</strong></p>
  
  <p>The content i am displaying in webview is in HTML format with iframe as one of the elements. Here is the sample data: </p>
  
  <pre><code>"&lt;p&gt;Some text&lt;/p&gt;
   &lt;p&gt;&lt;iframe src=\"https://www.youtube.com/embed/q7uBAtaK15I\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"&gt;&lt;/iframe&gt;   &lt;/p&gt;
  &lt;p&gt;some more text&lt;/p&gt;
  </code></pre>
  
  <p>This entire content is displayed in webview. What i want to achieve is when someone clicks on iframe, he should be prompted to <code>complete action using</code> that is, the person shd not be allowed to play the video in webview</p>