Javascript Frustration – Spaces in Window Names

It's the little things that drive us to an early grave. Was working on a page this morning, it had a Javascript call along the lines of:

function openPage(myPage,myTitle,settings) {

win =,myTitle, settings);


Then I had a link on the page:

<a href="javascript:openPage('demo.asp','document view','width=600,height=400,scrollbars=yes');">Click This</a>

Works in FireFox. Get error in Internet Explorer.

Of course took me 30 minutes of messing around to realise the problem – the space in the window title. Has to be 'documentview' with no space. You'd think I'd know better after all these years, but it's the little typos that cause us the most grief most often I reckon. FireFox is more adaptable and figured out that a space didn't make the blindest difference and let it through to the keeper. IE, of course, gave a useless indefinite error and wouldn't work.