Fetching contributors…
Cannot retrieve contributors at this time
108 lines (97 sloc) 4.15 KB
<!DOCTYPE html>
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See -->
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<title>Hello World</title>
<div class="app">
<h1>First page</h1>
<div id="deviceready" class="blink">
<p class="event listening">Connecting to Device</p>
<p class="event received">Device is Ready</p>
<button onclick="window.plugins.socialsharing.share('Message only', null, null, null, function(msg) {alert(msg)}, function(msg) {alert(msg)})">social sharing (needs plugin)</button>
<button onclick="alert('running cordova ' + device.cordova + ' on ' + device.platform)">device test (needs plugin)</button>
<button onclick="window.plugins.toast.showShortTop('Hello there!', function(a){console.log('toast success: ' + a)}, function(b){alert('toast error: ' + b)})">Toast showShortTop</button>
<button onclick="loadXHR()">Load file via embedded HTTP server</button>
<button onclick="document.getElementById('webglFrame').src=''">load webgl iframe</button>
<button onclick="inAppBrowser()">InAppBrowser</button>
<button onclick="storeInLS1()">Store val1 in LS</button>
<button onclick="storeInLS2()">Store val2 in LS</button>
<button onclick="readFromLS()">Read from LS</button>
<a href="" target="_blank">Test an external link</a>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript" src=""></script>
window.onerror = function(msg, file, line) {
alert(msg + '; ' + file + '; ' + line);
function storeInLS1() {
localStorage.setItem("mykey1", "myval1");
function storeInLS2() {
localStorage.setItem("mykey2", "myval2");
function readFromLS() {
alert("read: " + localStorage.getItem("mykey1") + " & " + localStorage.getItem("mykey2"));
// reroute protocol-less GET requests to our embedded http server to defeat Origin null issues
(function() {
var proxied =; = function(method, url, async, user, pass) {
if (method == "GET" && url.indexOf("://") == -1) {
arguments[1] = "http://localhost:12344/" + url; // assuming the (overridable) port is 12344
return proxied.apply(this, arguments);
function loadXHR() {
url: "loadMeByXHR.txt" // will be dynamically prefix with http://
}).done(function(msg) {
alert('done: ' + msg);
}).fail(function(msg) {
alert('fail: ' + JSON.stringify(msg));
function inAppBrowser() {
var ref ='', '_blank', 'location=yes');
<iframe id="webglFrame" src="" frameborder="0"></iframe>