Javascript Restrict number of open windows
here is a javascript code which allows:
- Check if window is open
- List open windows
- Manage 5 open windows (Any amount)
- Open restricted num. of windows.
function openWindowMAX5(p_url)
{
var win_I;
for(var i=0; i<5; i++)
{
win_I = window.open('', 'win_' + i);
if (win_I.document.location.href == 'about:blank')
{
window.status = 'win_'+i;
win_I = window.open(p_url, 'win_' + i);
break;
}
}
event.returnValue = false;
return false;
}
Used html code:
Open on new window
Tested on:
Working: IE7, CHROME 1.0.154
Not Working: Mozilla Firefox 3.0
No comments:
Post a Comment