Skip to content

Instantly share code, notes, and snippets.

@adrianlee
Created May 18, 2012 18:06
Show Gist options
  • Save adrianlee/2726785 to your computer and use it in GitHub Desktop.
Save adrianlee/2726785 to your computer and use it in GitHub Desktop.
webworks framework issue 85 bootstrap index.html
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="user-scalable=no, target-densitydpi=device-dpi, width=device-width">
<title>JNEXT PPS TEST</title>
<script>qnx.callExtensionMethod('webview.setEnableWebInspector', 1, true);</script>
<script>
window.testNS = {
windowGroup : -1,
id : -1
};
chrome = {};
chrome.internal = {};
chrome.internal.webEvent = function (id, eventId, value) {
var response;
console.log("EVENTENATED - id : " + id + " eventId: " + eventId + " value: "+ value);
if (eventId === "NetworkResourceRequested") {
console.log("NetworkResourceRequested!!!!!!!!!!!!!!!!");
// Accepts the start page only and denies the rest.
if (JSON.parse(value).url === "local:///index.html") {
response = { setAction: "ACCEPT" };
return JSON.stringify(response);
}
response = { setAction: "DENY" };
return JSON.stringify(response);
}
if (eventId === "Created") {
qnx.callExtensionMethod("webview.setVisible", id, true);
qnx.callExtensionMethod("webview.setActive", id, true);
qnx.callExtensionMethod("webview.setZOrder", id, 0);
qnx.callExtensionMethod("webview.setEnableNetworkResourceRequestedEvents", id, true);
qnx.callExtensionMethod("webview.setEnableCrossSiteXHR", id, true);
qnx.callExtensionMethod("webview.setGeometry", id, 0, 0, screen.width, screen.height);
qnx.callExtensionMethod("applicationWindow.setVisible", "true");
qnx.callExtensionMethod("webview.loadURL", id, "local:///index.html");
}
};
qnx.callExtensionMethod("webview.setEnableWebInspector", 1, true);
qnx.callExtensionMethod("webview.setEnableCrossSiteXHR", 1, "true");
qnx.callExtensionMethod("webview.setVisible", 1, "true");
qnx.callExtensionMethod("webview.setActive", 1, "false");
qnx.callExtensionMethod("webview.setGeometry", 1, 0, 0, screen.width, 0);
window.testNS.windowGroup = qnx.callExtensionMethod("webview.applicationWindowGroup", 1);
window.testNS.id = parseInt(qnx.callExtensionMethod("webview.create", window.testNS.windowGroup, "InProcess"), 10);
console.log("Created a webview with id " + window.testNS.id);
</script>
</head>
<body>
I am the man behind the curtain.
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment