Perl programmer for hire: download my resume (PDF).
John Bokma Intrusion
freelance Perl programmer

Comments: Pop-up windows

2 comments

Pop-up windows can be divided into two categories: the auto pop-up and the interactive pop-up. The former is notorious for its use of forcing onto visitors commercial messages, polls, and other messages. Pop-ups of this kind are either displayed when the page is visited or when the page is left (exit) beyond control of the user. Most exit pop-ups trigger new pop ups on closing so quite often it is a race between the visitor closing and those annoying windows opening. Due to the fact of major use for commercial purposes a lot of so-called "pop-up blocking programs" are in use today. Also the well known browser Mozilla and browsers based on Mozilla, like Firefox, have the option to block pop-ups. Most visitors not using blocking software are so used to closing auto pop-up windows that even a pop-up window containing for example a navigation menu (remote control) risks being closed before a good look has taken place.

Read the rest of Pop-up windows.

Comments

Hi John,

have been trying to figure out how to use javascript to open windows in a new page in order to be xhtml validated. Anyway, after finding a tutorial and coming to grips with it, i found your short article about making the code friendly, which was great, and which works.

Thing is, being a novice, i don't know how to apply the variables to your version of the code. I know what the variables are, and understand how they are applied to the 'bad' version i found the tutorial for, but not with your code, and you didn't say how on the page you wrote.

Your code said I should write:

<a href="file.htm" onclick="window.open(this.href);return false;">click here</a>

So if i wanted to add height, width, scrollbars etc... where in the line of code would i place them, and what tag (if any) would they be preceded by?

Hope this is ok to ask, feel free to ignore if you either haven't the time or this is an amazingly trivial question.

Many thanks,

Jules

Posted by Jules at 16:26 GMT on 17 June 2005

Hi Jules,

Gecko DOM reference: window.open() has excellent information on how to control the pop up Window features.

Note that features don't work with JavaScript off. Also adding them doesn't make the pop up bad per se (unless you reduce accessibility etc.).

What makes the pop up with a valid URL assigned to the href attribute versus javascript:... good is that it works even if JavaScript is turned off. Also it makes opening the link in a new tab work with Firefox.

Posted by John Bokma at 16:45 GMT on 17 June 2005

Post a comment

Note that your comment doesn't show up immediately. I review each comment before I add it to this site.

Check the Follow this page option if you want to receive an email each time a comment is posted to this page, including yours. A link to turn this option off will be included with each email.

Internet adresses will be converted automatically. You can use the following notation to specify anchor text for a link: [url=http://example.com/]example text[/url].