Hi,
My Requirement:
- Use single Browser window to display different web page content (Help information) on help Button click event.
- When help button is clicked : Set focus back on the allready opened Browser window when in case if the Browser window is minimized or behind other browser windows
- I am using vaadin 7
I have tried using BrowserWindow Opener but it does not serves my above mentioned requirement 2 as we do not get any handle to the opened browser windw in vaadin.
Related posts:
https://vaadin.com/forum#!/thread/4752167
https://vaadin.com/forum#!/thread/4731272
Now i understand that only way to implement the above mentioned requirements is through javascript.
For this i have written sample html/javascript code, but i am not sure how to use the same in vaadin application to achive the expected application behaviour.
Can anyone please help me on this, thanks in advance.
Following is the HTML/javascript code for the reference:
<html>
<head>
<script type="text/javascript">
var applicationHelpWindow = null;
var previousUrl;
function openRequestedSinglePopup(helpUrl)
{
/*If help window is null or closed - open new window*/
if(applicationHelpWindow == null || applicationHelpWindow.closed)
{
applicationHelpWindow = window.open(helpUrl, "HelpPopup","resizable,scrollbars,status");
}
/*If help URL is changed - set new URL to existing opened window*/
else if(previousUrl != helpUrl)
{
applicationHelpWindow = window.open(helpUrl, "HelpPopup","resizable,scrollbars,status");
//applicationHelpWindow = window.open(helpUrl, "HelpPopup","resizable=yes,scrollbars=yes,status=yes");
}
previousUrl = helpUrl;
/*set focus to application help window*/
if(applicationHelpWindow != null)
{
applicationHelpWindow.focus();
}
}
</script>
</head>
<body>
<input type="button" value="Vaadin" onclick="openRequestedSinglePopup('https://vaadin.com/');" >
<input type="button" value="Google" onclick="openRequestedSinglePopup('https://www.google.co.in/');" >
</body>
</html>
Regards,
Kunal Patil