All I want is to open a new window. Pretty simple in the scheme of things. I found out the other day that the A elements target attribute is deprecated. Because opening anything in a new window is A Bad Thing and Must Not Be Done. What about this form that I’ve got on the admin section of this site I’m working on? It accepts some html tags but the people using it aren’t coders so I’ve made a link next to it that (in Firefox, Safari, Chrome and Opera) opens a small window which has some example codes which can be copied and pasted in and edited as needs be.
At this point I should add a disclaimer. Opening new windows is frowned upon and understandably so. It can be annoying if unexpected and you can end up with a load of windows cluttering your desktop. However there are times, and this is one, where a new window is exactly what you need. I specifically need two windows side by side – one to type into, one to refer to. I guess I could make a hidden div that shows when you click the link or something like that but that’s not the point, damnit!
This would work:
<a href="admin/popup.html" target="_blank">help</a>
…unless you’re using HTML 4.01 strict, in which case it will still work but you will get an error as the target attribute is deprecated (I’m actually using XHTML for some reason and despite what you might read on the internet the target attribute is still allowed in XHTML, so I’ll probably end up doing this). Also you end up with a load of toolbars and stuff taking up screen space.
<a href="popup.html" onclick="window.open('popup.php', '', 'scrollbars=yes, menubar=no, height=400, width=400, resizable=yes, toolbar=no, location=no, status=no'); return false;">Help!</a>
I could have spent the time I spent writing this finding a workaround but I’ve already looked and haven’t found anything so far and anyway, fuck it, it’s the admin section. The front end works on every browser imaginable and that’s good enough for me.