Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jerkovicl/8419951 to your computer and use it in GitHub Desktop.
Save jerkovicl/8419951 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>InAppBrowser Tester</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="kendo/styles/kendo.mobile.all.min.css" rel="stylesheet">
<link href="styles/main.css" rel="stylesheet">
<script src="cordova.js"></script>
<script src="kendo/js/jquery.min.js"></script>
<script src="kendo/js/kendo.mobile.min.js"></script>
</head>
<body>
<div data-role="view">
<div>
<h1>Welcome!</h1>
<button data-role="button" data-click="app.setName">Set Name</button>
</div>
</div>
<script>
window.app = {
load: function() {
navigator.splashscreen.hide();
new kendo.mobile.Application( document.body );
},
setName: function() {
var win = window.open( "http://jsfiddle.net/tj_vantoll/K2yqc/show", "_blank",
"EnableViewPortScale=yes" );
win.addEventListener( "loadstop", function() {
win.executeScript({ code: "localStorage.setItem( 'name', '' );" });
var loop = setInterval(function() {
win.executeScript(
{
code: "localStorage.getItem( 'name' )"
},
function( values ) {
var name = values[ 0 ];
if ( name ) {
clearInterval( loop );
win.close();
$( "h1" ).html( "Welcome " + name + "!" );
}
}
);
});
});
}
};
document.addEventListener( "deviceready", app.load );
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment