How to transfer control to new window? Im working on a chrome packaged app with multi-window functionality. Suppose i click on "new window" and it opens up a new window this is the code im using:
background.js:
function create_window(opt_options)
{
chrome.app.window.create("main.html", opt_options,
});
}
Right after creating a new window im simply populating the value in the div
main.html
<html class="full-height">
<head>
<meta charset="utf-8">
<script src="jquery-2.0.2.js"></script>
<script src="main.js"></script>
</head>
<body>
<div id="username">Guest</div>
In main.html there a button that called the function for new function from background.js and add username in the div:
main.js
$(".menu-new-window").click(function() {
create_window()
$("user_name").html("John Doe");
});
The basic flow is, i select a user "John" from the list (parent/first window), a new window will open and John will be populated in the head section (div id username) of the new window. But after opening a new window it adds John in the parent window instead of new window. This happens whenever i open a new window, it always update its parent window.
I've just started developing the app so there's not much code to display, i've displayed some basic code of how im trying to work with multi-windows.
Please let me know if my question is not clear enough. Thanks!