Created
September 9, 2011 15:47
ChildBrowser Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="viewport" content="width=320; user-scalable=no" /> | |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> | |
<title>Child Browser Example</title> | |
<link rel="stylesheet" href="master.css" type="text/css" media="screen" title="no title" charset="utf-8"> | |
<script type="text/javascript" charset="utf-8" src="phonegap-1.0.0.js"></script> | |
<script type="text/javascript" charset="utf-8" src="childbrowser.js"></script> | |
<script type="text/javascript" charset="utf-8"> | |
// Wait for PhoneGap to load | |
// | |
function init(){ | |
document.addEventListener("deviceready", onDeviceReady, false); | |
} | |
// PhoneGap is ready | |
// | |
function onDeviceReady() { | |
console.log("PhoneGap is ready"); | |
} | |
function locationChanged(newurl) { | |
console.log("The JS got this url = " + newurl); | |
} | |
function closed() { | |
console.log("The JS got a close event"); | |
} | |
function showPage(locbar) { | |
window.plugins.childBrowser.onLocationChange = locationChanged; | |
window.plugins.childBrowser.onClose = closed; | |
window.plugins.childBrowser.showWebPage("http://www.phonegap.com", { | |
showLocationBar: locbar | |
}); | |
} | |
function openExternal() { | |
window.plugins.childBrowser.openExternal("http://www.phonegap.com"); | |
} | |
</script> | |
</head> | |
<body onload="init()" id="stage" class="theme"> | |
<a href="#" class="btn large" onclick="showPage(true); return false;">Show Page</a></p> | |
<a href="#" class="btn large" onclick="showPage(false); return false;">Show Page No Toolbar</a></p> | |
<a href="#" class="btn large" onclick="openExternal(); return false;">Old ChildBrowser</a></p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment