public void showWebPage()

in framework/src/org/apache/cordova/CordovaWebViewImpl.java [214:271]


    public void showWebPage(String url, boolean openExternal, boolean clearHistory, Map<String, Object> params) {
        LOG.d(TAG, "showWebPage(%s, %b, %b, HashMap)", url, openExternal, clearHistory);

        // If clearing history
        if (clearHistory) {
            engine.clearHistory();
        }

        // If loading into our WebView
        if (!openExternal) {
            // Make sure url is in allow list
            if (pluginManager.shouldAllowNavigation(url)) {
                // TODO: What about params?
                // Load new URL
                loadUrlIntoView(url, true);
                return;
            } else {
                LOG.w(TAG, "showWebPage: Refusing to load URL into webview since it is not in the <allow-navigation> allow list. URL=" + url);
                return;
            }
        }
        if (!pluginManager.shouldOpenExternalUrl(url)) {
            LOG.w(TAG, "showWebPage: Refusing to send intent for URL since it is not in the <allow-intent> allow list. URL=" + url);
            return;
        }

        Intent intent = null;
        try {
            if (url.startsWith("intent://")) {
                intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME);
            } else {
                intent = new Intent(Intent.ACTION_VIEW);
                // To send an intent without CATEGORY_BROWSER, a custom plugin should be used.
                intent.addCategory(Intent.CATEGORY_BROWSABLE);
                Uri uri = Uri.parse(url);
                // Omitting the MIME type for file: URLs causes "No Activity found to handle Intent".
                // Adding the MIME type to http: URLs causes them to not be handled by the downloader.
                if ("file".equals(uri.getScheme())) {
                    intent.setDataAndType(uri, resourceApi.getMimeType(uri));
                } else {
                    intent.setData(uri);
                }
            }
            if (cordova.getActivity() != null) {
                cordova.getActivity().startActivity(intent);
            } else {
                LOG.d(TAG, "Cordova activity does not exist.");
            }
        } catch (URISyntaxException e) {
            LOG.e(TAG, "Error parsing url " + url, e);
        } catch (ActivityNotFoundException e) {
            if (url.startsWith("intent://") && intent != null && intent.getStringExtra("browser_fallback_url") != null) {
                showWebPage(intent.getStringExtra("browser_fallback_url"), openExternal, clearHistory, params);
            } else {
                LOG.e(TAG, "Error loading url " + url, e);
            }
        }
    }