Use this button to toggle the Webview implementation.
' + + ''; + } + function doOpen (url, target, params, numExpectedRedirects, useWindowOpen) { numExpectedRedirects = numExpectedRedirects || 0; useWindowOpen = useWindowOpen || false; @@ -183,6 +229,9 @@ exports.defineManualTests = function (contentEl, createActionButton) { console.log('Use window.open() for url'); iab = window.open(url, target, params, callbacks); } else { + if (platformOpts) { + params += (params ? ',' : '') + platformOpts; + } iab = cordova.InAppBrowser.open(url, target, params, callbacks); } if (!iab) { @@ -305,6 +354,9 @@ exports.defineManualTests = function (contentEl, createActionButton) { var loadlistener = function (event) { alert('background window loaded '); }; // eslint-disable-line no-undef function openHidden (url, startHidden) { var shopt = (startHidden) ? 'hidden=yes' : ''; + if (platformOpts) { + shopt += (shopt ? ',' : '') + platformOpts; + } hiddenwnd = cordova.InAppBrowser.open(url, 'random_string', shopt); if (!hiddenwnd) { alert('cordova.InAppBrowser.open returned ' + hiddenwnd); // eslint-disable-line no-undef @@ -471,11 +523,11 @@ exports.defineManualTests = function (contentEl, createActionButton) { // see http://msdn.microsoft.com/en-us/library/windows/apps/hh465380.aspx#differences for details if (window.MSApp && window.MSApp.execUnsafeLocalFunction) { MSApp.execUnsafeLocalFunction(function () { - contentEl.innerHTML = info_div + local_tests + white_listed_tests + non_white_listed_tests + page_with_redirects_tests + pdf_url_tests + invalid_url_tests + + contentEl.innerHTML = info_div + platform_info + local_tests + white_listed_tests + non_white_listed_tests + page_with_redirects_tests + pdf_url_tests + invalid_url_tests + css_js_injection_tests + open_hidden_tests + clearing_cache_tests + video_tag_tests + local_with_anchor_tag_tests + hardwareback_tests; }); } else { - contentEl.innerHTML = info_div + local_tests + white_listed_tests + non_white_listed_tests + page_with_redirects_tests + pdf_url_tests + invalid_url_tests + + contentEl.innerHTML = info_div + platform_info + local_tests + white_listed_tests + non_white_listed_tests + page_with_redirects_tests + pdf_url_tests + invalid_url_tests + css_js_injection_tests + open_hidden_tests + clearing_cache_tests + video_tag_tests + local_with_anchor_tag_tests + hardwareback_tests; } @@ -489,6 +541,20 @@ exports.defineManualTests = function (contentEl, createActionButton) { var injectjs = isWindows ? basePath + 'inject.js' : 'inject.js'; var injectcss = isWindows ? basePath + 'inject.css' : 'inject.css'; var videohtml = basePath + 'video.html'; + if (isIos) { + createActionButton('Webview=UIWebView', function () { + var webviewOption = 'usewkwebview='; + var webviewToggle = document.getElementById('webviewToggle'); + var button = webviewToggle.getElementsByClassName('topcoat-button')[0]; + if (platformOpts === webviewOption + 'yes') { + platformOpts = webviewOption + 'no'; + button.textContent = 'Webview=UIWebView'; + } else { + platformOpts = webviewOption + 'yes'; + button.textContent = 'Webview=WKWebView'; + } + }, 'webviewToggle'); + } // Local createActionButton('target=Default', function () { @@ -679,17 +745,17 @@ exports.defineManualTests = function (contentEl, createActionButton) { doOpen('http://cordova.apache.org', '_blank', 'hardwareback=no'); }, 'openHardwareBackNo'); createActionButton('no hardwareback -> hardwareback=no -> no hardwareback', function () { - var ref = cordova.InAppBrowser.open('https://google.com', '_blank', 'location=yes'); + var ref = cordova.InAppBrowser.open('https://google.com', '_blank', 'location=yes' + (platformOpts ? ',' + platformOpts : '')); ref.addEventListener('loadstop', function () { ref.close(); }); ref.addEventListener('exit', function () { - var ref2 = cordova.InAppBrowser.open('https://google.com', '_blank', 'location=yes,hardwareback=no'); + var ref2 = cordova.InAppBrowser.open('https://google.com', '_blank', 'location=yes,hardwareback=no' + (platformOpts ? ',' + platformOpts : '')); ref2.addEventListener('loadstop', function () { ref2.close(); }); ref2.addEventListener('exit', function () { - cordova.InAppBrowser.open('https://google.com', '_blank', 'location=yes'); + cordova.InAppBrowser.open('https://google.com', '_blank', 'location=yes' + (platformOpts ? ',' + platformOpts : '')); }); }); }, 'openHardwareBackDefaultAfterNo'); diff --git a/types/index.d.ts b/types/index.d.ts index ea3d3ad..fa9e529 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -2,9 +2,11 @@ // Project: https://github.com/apache/cordova-plugin-inappbrowser // Definitions by: Microsoft Open Technologies Inc