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:43:57 UTC

[2/2] spec commit: [CB-2308] Add Spec tests for InAppBrowser error channel

[CB-2308] Add Spec tests for InAppBrowser error channel


Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/bcff8c89
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/bcff8c89
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/bcff8c89

Branch: refs/heads/master
Commit: bcff8c894e3b168f0643f29ee4e72d0b24c9b40b
Parents: 7b41adc
Author: Ian Clelland <ic...@chromium.org>
Authored: Thu Mar 14 13:33:46 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Wed Mar 20 15:43:49 2013 -0400

----------------------------------------------------------------------
 inappbrowser/index.html |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/bcff8c89/inappbrowser/index.html
----------------------------------------------------------------------
diff --git a/inappbrowser/index.html b/inappbrowser/index.html
index 4c64eaf..cfa68b9 100644
--- a/inappbrowser/index.html
+++ b/inappbrowser/index.html
@@ -54,6 +54,14 @@
         },1000);
     }
 
+    function openWithErrorHandler(url) {
+        var iab = window.open(url, '_blank', 'location=yes');
+        iab.addEventListener('loaderror',
+             function(error) {
+                 alert("Error Channel Fired\nCode: " + error.code + "\nMessage: " +error.message);
+             }
+        );
+    }
 </script>
 
   </head>
@@ -90,6 +98,10 @@
     <h1>PDF URL</h1>
     <div class="btn large" onclick="window.open('http://www.stluciadance.com/prospectus_file/sample.pdf');">Remote URL</div>
     <div class="btn large" onclick="window.open('local.pdf', '_blank');">Local URL</div>
+    <h1>INVALID URL</h1>
+    <div class="btn large" onclick="openWithErrorHandler('x-ttp://www.invalid.com/');">Invalid Scheme</div>
+    <div class="btn large" onclick="openWithErrorHandler('http://www.inv;alid.com/');">Invalid Host</div>
+    <div class="btn large" onclick="openWithErrorHandler('nonexistent.html');">Missing File</div>
     <h2> </h2><div class="backBtn" onclick="backHome();">Back</div>
   </body>
 </html>