You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2013/03/20 20:36:49 UTC

docs commit: [CB-2308] Document loaderror event

Updated Branches:
  refs/heads/master fe9cd8d4b -> 08d685ec1


[CB-2308] Document loaderror event


Project: http://git-wip-us.apache.org/repos/asf/cordova-docs/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-docs/commit/08d685ec
Tree: http://git-wip-us.apache.org/repos/asf/cordova-docs/tree/08d685ec
Diff: http://git-wip-us.apache.org/repos/asf/cordova-docs/diff/08d685ec

Branch: refs/heads/master
Commit: 08d685ec1effd9e5f1a35b6c8e4ac3f0484c27dc
Parents: fe9cd8d
Author: Ian Clelland <ic...@chromium.org>
Authored: Fri Mar 15 11:58:18 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Wed Mar 20 15:36:39 2013 -0400

----------------------------------------------------------------------
 docs/en/edge/cordova/inappbrowser/inappbrowser.md |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-docs/blob/08d685ec/docs/en/edge/cordova/inappbrowser/inappbrowser.md
----------------------------------------------------------------------
diff --git a/docs/en/edge/cordova/inappbrowser/inappbrowser.md b/docs/en/edge/cordova/inappbrowser/inappbrowser.md
index 7caa962..bbf5cf6 100644
--- a/docs/en/edge/cordova/inappbrowser/inappbrowser.md
+++ b/docs/en/edge/cordova/inappbrowser/inappbrowser.md
@@ -72,6 +72,7 @@ addEventListener
 
         loadstart - event fired when the InAppBrowser starts to load a URL 
         loadstop - event fired when the InAppBrowser finished loading a URL
+        loaderror - event fired when the InAppBrowser encounters an error loading a URL
         exit - event fired when the InAppBrowser window is closed 
 
 - __callback:__ the function that is called when the event is fired. 
@@ -109,9 +110,10 @@ Full Example
         //
         function onDeviceReady() {
              var ref = window.open('http://apache.org', '_blank', 'location=yes');
-             ref.addEventListener('loadstart', function() { alert('start: ' + event.url); });
-             ref.addEventListener('loadstop', function() { alert('stop: ' + event.url); });
-             ref.addEventListener('exit', function() { alert(event.type); });
+             ref.addEventListener('loadstart', function(event) { alert('start: ' + event.url); });
+             ref.addEventListener('loadstop', function(event) { alert('stop: ' + event.url); });
+             ref.addEventListener('loaderror', function(event) { alert('error: ' + event.message); });
+             ref.addEventListener('exit', function(event) { alert(event.type); });
         }
 
         </script>
@@ -132,6 +134,7 @@ removeEventListener
 
         loadstart - event fired when the InAppBrowser starts to load a URL 
         loadstop - event fired when the InAppBrowser finished loading a URL
+        loaderror - event fired when the InAppBrowser encounters an error loading a URL
         exit - event fired when the InAppBrowser window is closed 
 
 - __callback:__ the function that was to be called when the event is fired. 
@@ -178,10 +181,15 @@ Full Example
             alert(event.type + ' - ' + event.url);
         }
    
+        function iabLoadError(event) {
+            alert(event.type + ' - ' + event.message);
+        }
+   
         function iabClose(event) {
              alert(event.type);
              iabRef.removeEventListener('loadstart', iabLoadStart);
              iabRef.removeEventListener('loadstop', iabLoadStop);
+             iabRef.removeEventListener('loaderror', iabLoadError);
              iabRef.removeEventListener('exit', iabClose);
         }
 
@@ -191,6 +199,7 @@ Full Example
              iabRef = window.open('http://apache.org', '_blank', 'location=yes');
              iabRef.addEventListener('loadstart', iabLoadStart);
              iabRef.addEventListener('loadstop', iabLoadStop);
+             iabRef.removeEventListener('loaderror', iabLoadError);
              iabRef.addEventListener('exit', iabClose);
         }