A LIST Apart: For People Who Make Websites

No. 174

Discuss: Accessible Pop-up Links

Pages

 <  1 2 3 4 5 >  Last »

21 Good but...

This was actually more than adequate. That’s pretty rare for A a JS article on ALA (except for the image gallery). No offense.
But you’re making it too complicated. It shouldn’t take an entire article to explain this.

Overall too complicated but nice.

posted at 05:05 pm on March 19, 2004 by Dante-Cubed

22 Can fail with popup blocking?

Returning false without checking to see if the new window exists can fail in browsers like Mozilla (not Firefox) where there is an option to “block all popups,” not just “block unrequested popups.” That’s the reason for the scripts posted in the 1st and 7th comments.

http://cookiecrook.com/include/popup.txt
http://yayforgecko.net/newWin.js

Incidentally, I’m not the same James that wrote the less-than-helpful 3rd comment. ;) Hopefully this one was helpful. Cheers.

posted at 05:23 pm on March 19, 2004 by James Craig

23 re: Can fail with popup blocking?

James,

I tested thoroughly in Firefox and assumed Mozilla would be fine. Guess not. The script can be easily fixed, and I guess it’s probably worthy it.

So I’ll contact ALA and see what can be done about updating the article.

posted at 06:47 pm on March 19, 2004 by Caio Chassot

24 some different approaches: sorry for the long post

When I started surfing the net (around 96 or 97) it was quite common to use the right click to open a new window. Decision was on user side. Then, I don’t know how or why (was it due to frames’ targets? Adds?), everyone relies on either javascript or target to open new windows, and people got lazy enough to forget about the chances they have. Opening a popup for a bigger image is ok. Opening a popup for terms and conditions is ok. But most of the times I will want to decide where to open links. Abuse of target or javascript pseudoprotocol has caused people to forget about our chances as users. If I want to open a new window to follow a link, I will. Don’t worry, if your site was interesting enough I still have the back button. Abusing the target is bad, but using the javascript pseudoprotocol to open popup’s is evil, as explained in this ALA article. But lets discuss the methods.

If in the need of using a new window we have some options.

1. The “excuse” of the lack of target validation in newer DOCTYPEs is not enough. You’re most likely talking about XHTML strict (or 1.1). Since it’s eXtensible, you can add your own module, or adapt the target module as provided in other DOCTYPEs. This way you have the functionality and the validation (if that matters to you). I learnt this from Mariano at http://www.byklein.com/ who arranged this little example (I keep a copy here: http://meddle.dzygn.com/tests/targetblank/) following an intersting discussion at http://www.domestika.org/foros/viewtopic.php?t=19583 (in spanish)

2. Or you can simply ignore validation and use target easily.

3. But my argument is: as a user, (most of the times) I still want to decide. A simple preferences page where I could choose whether or not I want to open external links in new windows would store a value in a cookie. Then running a script like this would suffice (if suffice means bypassing xhtml strict validation): http://meddle.dzygn.com/tests/targetblank/retarget.js This script uses the DOM to check for external links and adds the target using javascript. This is done either automatically or if a cookie has the accepted value. Execution relies on event handling, so it doesn’t interfere with any other onload events you might have. And since it used a proper namespace, it’s likely you don’t have same function names in your code. You need no markup in your html and user can choose.

4. A special case would be those windows that should be open in a new window with special properties. The solution presented in this article is acceptable. Not bad, not new. Aaron Boodman and Scott Andrew already told us several months ago (2 years now?). I would probably prefer the following, but yours is ok too:
<a >alistapart</a>

If you’re not really in the need of using a new window, we still have some options to make navigation more pleasant. For instance, let users know a link is external by adding a little image next to it. You can use a similar approach as the script above, but adding an image inside the a tag, or use CSS, something like:

a[href^=“http”] { padding-right: 10px; background-image: url(external.gif); background-position: right !important; background-repeat: no-repeat;
}

The user would have to use right click (or use the tabs options) to open in a separate window/tab, but he would be prevented. I mean, this is just presentational, but combined with the target module in point 1 or a script similar to point 3 or 4 it’d work fully. From my point of view, for most of the current sites, this CSS only approach would probably be the most elegant solution.

posted at 06:49 pm on March 19, 2004 by Sergi

25 ^ Selector

Problem is that IE has no support for the ^ selector (nor !important). I can sympathize; it’s CSS3. In May I’m going to start a CSS3 Tests Site.

posted at 07:15 pm on March 19, 2004 by Dante-Cubed

26 Custom attributes

I you want even cleaner way with popups see http://www.quirksmode.org/js/popup.html#link7.
I was thinking of something like this in the anchor:
[url=“pupage.html” type=“popup” directories=“no”]Popup[/url]
Or even more custom attributes. Custom attributes are another benefit of sticking to Quirks Mode.

posted at 10:34 pm on March 19, 2004 by Dante-Cubed

27 No ultimate solutions here...

Problem with this script is that pop-up-blocker’s kill it. I would prefer a DOM-solution of a new window within the same window.

posted at 03:29 am on March 20, 2004 by Paul de Beer

28 Why not just use this one

<a >
Link
</a>

it works everywhere, the href is specified and allows bookmarking whatever and is very small =)

posted at 04:02 am on March 20, 2004 by helge

29 Caio Chassot is a total babe

Under the heading “Separate logic and presentation”, the code line:

listen(‘load’, window, function() {

appears to be missing a closing parenthesis.

Rad article though, I look forward to delving into you library.

posted at 05:30 am on March 20, 2004 by Richard D. Bartlett

30 Crooked way

Using ‘target’ is deprecated. It’s excluded from XHTML 1.1, and all stricter DTD’s for all versions of HTML. Hence, don’t use it. Instead, one can use JavaScript and the ‘rel’ attribute on links, as described in this Article:

http://www.sitepoint.com/article/1041

posted at 07:14 am on March 20, 2004 by Asbjørn Ulsberg

Pages

 <  1 2 3 4 5 >  Last »

Discussion Closed

New comments are not being accepted, but you are welcome to explore what people said before we closed the door.

Got something to say?

Discuss this article. We reserve the right to delete flames, trolls, and wood nymphs.

Create a new account or sign in below if you’d like to leave a comment.

Remember me

Forgot your password?

Subscribe to this article's comments: RSS (what’s this?)