From 2a3a0cecab0fd02e71c5a4ce867c627ec5c17b8a Mon Sep 17 00:00:00 2001 From: Jesse MacFadyen Date: Wed, 20 Jul 2016 13:10:14 -0700 Subject: [PATCH] CB-5402 added extra content from wiki page --- README.md | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a8defd4..5df021a 100644 --- a/README.md +++ b/README.md @@ -227,7 +227,7 @@ The object returned from a call to `cordova.InAppBrowser.open` when the target i ```javascript -var inAppBrowserRef = undefined; +var inAppBrowserRef; function showHelp(url) { @@ -625,3 +625,49 @@ function executeScriptCallBack(params) { } ``` + +## More Usage Info + +### Local Urls ( source is in the app package ) +``` +var iab = cordova.InAppBrowser; + +iab.open('local-url.html'); // loads in the Cordova WebView +iab.open('local-url.html', '_self'); // loads in the Cordova WebView +iab.open('local-url.html', '_system'); // Security error: system browser, but url will not load (iOS) +iab.open('local-url.html', '_blank'); // loads in the InAppBrowser +iab.open('local-url.html', 'random_string'); // loads in the InAppBrowser +iab.open('local-url.html', 'random_string', 'location=no'); // loads in the InAppBrowser, no location bar + +``` + + + +### Whitelisted Content + +``` +var iab = cordova.InAppBrowser; + +iab.open('http://whitelisted-url.com'); // loads in the Cordova WebView +iab.open('http://whitelisted-url.com', '_self'); // loads in the Cordova WebView +iab.open('http://whitelisted-url.com', '_system'); // loads in the system browser +iab.open('http://whitelisted-url.com', '_blank'); // loads in the InAppBrowser +iab.open('http://whitelisted-url.com', 'random_string'); // loads in the InAppBrowser + +iab.open('http://whitelisted-url.com', 'random_string', 'location=no'); // loads in the InAppBrowser, no location bar + +``` + +### Urls that are not white-listed + +``` +var iab = cordova.InAppBrowser; + +iab.open('http://url-that-fails-whitelist.com'); // loads in the InAppBrowser +iab.open('http://url-that-fails-whitelist.com', '_self'); // loads in the InAppBrowser +iab.open('http://url-that-fails-whitelist.com', '_system'); // loads in the system browser +iab.open('http://url-that-fails-whitelist.com', '_blank'); // loads in the InAppBrowser +iab.open('http://url-that-fails-whitelist.com', 'random_string'); // loads in the InAppBrowser +iab.open('http://url-that-fails-whitelist.com', 'random_string', 'location=no'); // loads in the InAppBrowser, no location bar + +``` \ No newline at end of file