Go Back   SitePoint Forums > Forum Index > Design Your Site > Web Page Design > Accessibility and Usability
Newsletter FAQ Members List Calendar Mark Forums Read

New to SitePoint Forums? Register here for free!

SitePoint Sponsor
 
Reply
 
Thread Tools Display Modes
Old Oct 15, 2009, 06:12   #1
geargolum
SitePoint Enthusiast
 
Join Date: Feb 2007
Location: East of Ottawa, ON
Posts: 89
window.open

Is this accessible?

I did add a note indicating that it opens in a new window.

"Please note: this link will open the page in a new browser window."
geargolum is offline   Reply With Quote
Old Oct 15, 2009, 06:51   #2
AutisticCuckoo
SitePoint Wizard
 
Join Date: Nov 2004
Location: Åsnorrbodarna
Posts: 11,581
That depends on how you invoke window.open().

This will be accessible,
HTML4Strict Code:
<a href="popup.html" onclick="return !!window.open(this.href,'popup')">link text</a>

This won't,
HTML4Strict Code:
<a href="javascript:window.open('popup.html','popup')">link text</a>
AutisticCuckoo is offline   Reply With Quote
Old Oct 15, 2009, 11:24   #3
geargolum
SitePoint Enthusiast
 
Join Date: Feb 2007
Location: East of Ottawa, ON
Posts: 89
I'm using jquery click function for this.

So if I disable javascript the page will open in the same window.
geargolum is offline   Reply With Quote
Old Oct 15, 2009, 11:27   #4
geargolum
SitePoint Enthusiast
 
Join Date: Feb 2007
Location: East of Ottawa, ON
Posts: 89
JavaScript Code:
$('#accordion li a').click( function() {
        window.open( $(this).attr('href'), "foo", "toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=828,height=648,top=25,left=60");
        return false;
    }).attr("title", "Please note: this link will open the page in a new browser window.");;
 
 });
geargolum is offline   Reply With Quote
Old Oct 15, 2009, 12:16   #5
AutisticCuckoo
SitePoint Wizard
 
Join Date: Nov 2004
Location: Åsnorrbodarna
Posts: 11,581
Quote:
Originally Posted by geargolum View Post
So if I disable javascript the page will open in the same window.
That should take care of the accessibility issue, although there may or may not be a usability issue with forcing a pop-up window to begin with.

Also, the text that informs the user that the link opens in a new window should be created with JavaScript, since the function itself requires JavaScript. And it shouldn't be in a title attribute only, since there is no guarantee that a user will see that. Especially those of us who navigate by keyboard rarely see those advisory titles.
AutisticCuckoo is offline   Reply With Quote
Old Oct 16, 2009, 07:42   #6
AlexDawson
SitePoint Mentor
 
AlexDawson's Avatar
 
Join Date: Feb 2009
Location: England, UK
Posts: 4,416
I would also note that you should have some form of fail-safe mechanism in place to check if popup's are blocked, the ideal scenario would be that if people have pop-up messages enabled then it would use your unobtrusive script to make that happen, but if pop-up's are blocked (possibly test through JavaScript?) or if scripting is not enabled, it will simply navigate to the URL. I have seen websites redirect when a pop-up fails so it must be possible
AlexDawson is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread | Next Thread »

Thread Tools
Display Modes

 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Sponsored Links
 
Forum Jump


All times are GMT -7. The time now is 13:03.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright 1998-2009, SitePoint Pty Ltd. All Rights Reserved