cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Cordova Wiki] Update of "InAppBrowser" by ShazronAbdullah
Date Thu, 15 Nov 2012 23:58:08 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Cordova Wiki" for change notification.

The "InAppBrowser" page has been changed by ShazronAbdullah:
http://wiki.apache.org/cordova/InAppBrowser?action=diff&rev1=6&rev2=7

Comment:
Updated spec based on ML discussion

  
  The declarative API is based on the target attribute on anchor elements. 
  
+   || _blank || new in-app browser instance  ||
-   || _blank || system browser ||
+   || _system || system browser ||
-   || _self || in application browser ||
+   || _self || in current browser instance ||
  
  
  [1] http://www.w3.org/TR/html401/types.html#type-frame-target
  
- == Programatic API ==
  
+ == Specification ==
- [A] {{{ window.open('local-url.html', '_self'); // loads in CordovaView. _parent and _top
same thing }}}<<BR>>
- [B] {{{ window.open('local-url.html', '_blank'); // loads in InAppBrowser }}}<<BR>>
- [C] {{{ window.open('http://whitelisted-url.com', '_self'); // loads in CordovaView }}}<<BR>>
- [D] {{{ window.open('http://whitelisted-url.com', '_blank'); // loads in InAppBrowser }}}<<BR>>
- [E] {{{ window.open('http://random-url.com', '_self'); // loads in InAppBrowser }}}<<BR>>
- [F] {{{ window.open('http://random-url.com', '_blank'); // native browser }}}<<BR>>
  
- [G] {{{ window.location = 'foo' }}} is equivalent to the '_self' options above.
+ '''window.open( strUrl, strWindowName[, strWindowFeatures])'''
  
+ ```strUrl```
+    this is a url, prefixed with a scheme for external urls or a filename for urls that exist
in the local www folder
+    
+ ```strWindowName```
+     valid values are "_self", "_system", "_blank", or null. null is treated the same as
"_self", any other value is treated as "_blank".
+ 	
+ 	"_self"   -> opens in the Cordova !WebView if strUrl is in the white-list, else it opens
in the InAppBrowser <<BR>>
+ 	"_system" -> always open in the system web browser <<BR>>
+ 	"_blank"  -> always open in the InAppBrowser <<BR>>
+ 	
+ ```strWindowFeatures```
+     Optional parameter listing the features of the new window. The string must not contain
any blank space, each feature name and value must be separated by a comma. We only support
the value below:
+ 	
+ 	location --> set to 'yes' or 'no' to turn the location bar on or off for the InAppBrowser
+ 	
+ 
+ == Example usage ==
+ 
+ === 1. Local urls ===
+ 
+ {{{#!highlight javascript
+ window.open('local-url.html');                  // loads in the Cordova WebView 
+ window.open('local-url.html', '_self');         // loads in the Cordova WebView
+ window.open('local-url.html', '_system');       // Security error: system browser, but url
will not load (iOS)
+ window.open('local-url.html', '_blank');        // loads in the InAppBrowser
+ window.open('local-url.html', 'random_string'); // loads in the InAppBrowser
+ window.open('local-url.html', 'random_string', 'location=no'); // loads in the InAppBrowser,
no location bar
+ }}}
+ 
+ === 2. White-listed urls ===
+ 
+ {{{#!highlight javascript
+ window.open('http://whitelisted-url.com');                  // loads in the Cordova WebView
+ window.open('http://whitelisted-url.com', '_self');         // loads in the Cordova WebView
+ window.open('http://whitelisted-url.com', '_system');       // loads in the system browser
+ window.open('http://whitelisted-url.com', '_blank');        // loads in the InAppBrowser
+ window.open('http://whitelisted-url.com', 'random_string'); // loads in the InAppBrowser
+ window.open('http://whitelisted-url.com', 'random_string', 'location=no'); // loads in the
InAppBrowser, no location bar
+ }}}
+ 
+ === 3. Urls that are not white-listed ===
+ 
+ {{{#!highlight javascript
+ window.open('http://url-that-fails-whitelist.com');                  // loads in the InAppBrowser
+ window.open('http://url-that-fails-whitelist.com', '_self');         // loads in the InAppBrowser
+ window.open('http://url-that-fails-whitelist.com', '_system');       // loads in the system
browser
+ window.open('http://url-that-fails-whitelist.com', '_blank');        // loads in the InAppBrowser
+ window.open('http://url-that-fails-whitelist.com', 'random_string'); // loads in the InAppBrowser
+ window.open('http://url-that-fails-whitelist.com', 'random_string', 'location=no'); // loads
in the InAppBrowser, no location bar
+ }}}
+ 
+ window.location = 'foo'  is equivalent to the '_self' options above.
+ 
+ {{{#!wiki tip
+ '''Tip'''
+ 
- Local and whitelisted URLs should be opened with Cordova functionality by default (_self)
and you have to be explicit if you want those trusted resources opened without Cordova functionality
(_blank).
+ Local and whitelisted URLs should be opened with Cordova functionality by default (_self)
and you have to be explicit if you want those trusted resources opened without Cordova functionality
(_blank or _system).
+ }}}
+ 
  
  == Existing Work ==
  
@@ -33, +86 @@

  
  == Mailing List Discussion ==
  
- http://markmail.org/thread/tmcjk33lszn7hxhc
+ 1. http://markmail.org/thread/tmcjk33lszn7hxhc
  
- == Comment ==
+ 2. http://markmail.org/thread/wbka4n6zzto44hgr
  
- Maybe we should make the method...
- 
- {{{ window.open(url, name, options); }}}
- 
- That way it would map directly to the current window.open command in JS. Not sure if having
the name provides any other benefit than consistency.
- 
- Also, as part of the options can we add "location=0|1"? To control whether or not the location
bar should be shown?
- 

Mime
View raw message