Creating accessible Popup windows
Often when we create complex pages with lots of content it’s advantageous to use popups for smalls bits of information such a “Help” text. However since the introduction of popup blockers this once simple task has proven to be a tedious job. For example, by default the IE 6 Popup Blocker will block active scripting opening windows without user clicks i.e. using onload() in the body tag for instance. Higher security settings in IE will even prevent scripted popups running off user clicks. So what’s the answer? I came up with a few ideas, my initial thought was to try and detect if my window would be blocked. To do this I would check whether window.open returned a reference to an object:
function popUpWin(url, width, height) {
if (window.open) {
window.open(...);
} else {
alert('It appears your browser is blocking popup windows');
}
}
<a href="javascript:popUpWin(disclaimer.htm, 450, 500)">Read Disclaimer</a>
Although sites use this today it’s not a viable solution because it primarily validates the browser and ultimate won’t provide the user with a working link. Instead the user is expected to go off and adjust their browser settings and re-launch the window. Worse still they might potentially miss important information you were trying to provide in that popup (i.e. a disclaimer).
My next more user-orientated solution is what I use today. Employing the JavaScript onclick() function we can call our popUpWin() funcion, and at the same time we can still use our href attribute to supply a normal link if the javascript fails:
function popUpWin(url, width, height) {
if (window.open) {
window.open(...);
}
}
<a href="disclaimer.htm" onclick="popUpWin(this.href, 450, 500);return false;" >Read Disclaimer</a>






A good follow up article with some more links is this URL: http://css-discuss.incutio.com/?page=NewWindow
Comment by Cameron Manderson — August 6, 2006 @ 8:49 pm
Another good link to the window.open syntax can be found using this link:
http://www.javascript-coder.com/window-popup/javascript-window-open.phtml
Comment by Cameron Manderson — August 7, 2006 @ 9:48 am