I have an application that opens a new window on clicking a button.
There are many buttons to open multiple windows if the windows don't already exist.
All the buttons and url are dynamic, therefore, I use a function to open window with the following codes:
function openwin(url, winname)
{
var winRef = window[winname];
if( typeof winRef =='undefined' || winRef.closed)
{
winRef = window.open (url, 'winname');
winRef.focus();
}
}
But there is problem/bug:
When I click on button A, it opens new window A.
When I click on button B, it "overwrite A" and the window become B.
When I click on button A again, it "overwrite B" and the window become A.
Therefore, I always open one new window.