Welcome to WebmasterWorld Guest from

Forum Moderators: ergophobe

Message Too Old, No Replies

Thoughts on target=" blank" ?

How would you react to a new window in these situations?



4:54 am on Oct 30, 2008 (gmt 0)

5+ Year Member

Hi guys - quickie opinion, if you don't mind.

I'm currently using target="_blank" on all the links that take the user to a pdf (used for a print-friendly version of a page) because the pdf can't contain links and I don't want to "orphan" the user.

Good or bad? Are we to the point where I can reasonably assume everyone can find the "back" button? Does a new window (or tab, depending on browser settings) just confuse / frustrate the user more? My site is about art photography, and tends to cater to a slightly older demographic (40-65 ish).

How about external links? I'd like to keep users on my site as much as possible, and I'm willing to bet most of them don't know about the right-click -> "new window" option. Is using it here just being greedy?

I'm thinking of moving to a strict doc-type, and I'm not really interested in using a JS workaround.



7:05 am on Oct 30, 2008 (gmt 0)

WebmasterWorld Senior Member tangor is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

Frankly, and I am in your age group, I dislike this intensely. See it once, I'm gone. Tell it up front it is PDF and rely on their browser having the plugin. And if they don't have the plugin tell them how to update for that function. This way the BACK button functions perfectly and they are still on the site.


1:38 pm on Oct 30, 2008 (gmt 0)

5+ Year Member

OK, noted - thanks tangor ... that certainly goes with what I've seen elsewhere. Anyone else? Does anyone actually LIKE something opening in a new window?

Getting rid of it sure would make going "strict" a whole lot easier.

Anyone know what the percentage of browsers still around WITHOUT pdf plugins is? How do they handle clicking on a pdf?


2:18 pm on Oct 31, 2008 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

While I agree "new windows" are overused, IMO there are good reasons for them. PDF is one of them, mostly because when it's first followed there's often a delay while the browser loads up the plugin and PDF. This is "something different" and outside the normal exploration of the rest of your pages.

Another good one is "supplemental information" like small help files or supplemental content that would ordinarily clog up the topic with tangent data.

What's annoying is when the navigation is to an ordinary page but the author seems to think a new window "keeps them on the site" more. Examples: A TOS or anything that moves from the prime objective: sell, sell, sell.

In this case, it's always good to do:

<a href="mypdf.pdf" target="_blank">View</a> (PDF 15K, new window)

... So they have some indication of what to expect.

I'm thinking of moving to a strict doc-type, and I'm not really interested in using a JS workaround.

You can do JS in a strict doctype and it will validate. Just do it externally, attaching behaviors on load, and don't clog up the document with inline JS.

<script type="text/javascript" src="your.js"></script>

window.onload=function() { attachBehaviors(); }

... where attachBehaviors attaches .... behaviors .... to document elements by classname or id.

In your document, these elements would of course have support for non-JS browsers. If present, the JS overrides natural behavior. Read up on "unobtrusive Javascript".

I prefer JS methods over "target="_blank" for one reason. Target="_blank" will always open a new window or tab exactly the same size as the original, covering up the original and is extremely confusing or disorienting, especially if the user clicks and looks away for a slurp of coffee.

With a Javascript method, you can control the size of the window so that's it's VERY obvious it's a new window and you can still see the parent behind it. As above, support for non-JS is mandatory (self-imposed.) This is an inline example, but in practice this would be externally loaded as mentioned:

<a href="mypdf.pdf" target="_blank" onClick="newWin('mypdf.pdf');>View</a> (PDF 15K, new window)
<script type="text/javascript">
function newWin(url) {
var day=new Date();
var id=day.getTime(); // Unique, assures new win. on every click
var win = open(url,id,600,500,'scrollbars,resizable');

If JS is disabled, it uses blank.
Even with JS - consider the user and always allow these to be resizable and with scrollbars.


2:29 pm on Oct 31, 2008 (gmt 0)

WebmasterWorld Senior Member pageoneresults is a WebmasterWorld Top Contributor of All Time 10+ Year Member

Does anyone actually LIKE something opening in a new window?

I do. I use JS quite a bit to open new windows especially for documents that are typically not viewed as a web page such as pdfs.

I've done some extensive usability testing in this area. I've managed an online distance education program for years. The JS popups we have throughout the site have served the visitors very well and continue to do so. We make sure our popups are void of anything other than the material they are viewing. No toolbars, no address window, nothing but a fixed window size that is positioned based on their interaction with the system. We may have windows opening to the right, to the left, from the top, etc. It is all relative to what is on the page and where we'd like the user to see the window when invoked.

Also, that target="_blank" attribute is deprecated so there are usually challenges during validation of Strict DOCTYPEs.


6:21 pm on Oct 31, 2008 (gmt 0)

5+ Year Member

Thanks to all very much. I think I'll dump it for the external links, and only keep it as a JS popup (if it truly works elegantly and cross-browser) for PDFs only. Users without JS will just get the pdf in the same window. Poor them.

In future, I might explore having a link to a page with a content div (frame? - don't wanna) containing the document to print, and a "print" button that only prints the div. Somehow. But that's later.

Thanks again.


7:44 pm on Oct 31, 2008 (gmt 0)

WebmasterWorld Senior Member jimbeetle is a WebmasterWorld Top Contributor of All Time 10+ Year Member


But making a reappearance in HTML 5?


12:50 pm on Nov 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member


coming in a bit late but here is my take.

As your pdfs are not used to be read but to be printed, you could serve the pdf as a choice to open/save(see here -http://www.stuvel.eu/pdfdownload ). We do this on all our sites.

Another idea would be to use the print stylesheet - see here [webmasterworld.com] and there [webmasterworld.com].

And finally if the print style is not an option and want to explore the js solution have a look here ( [webcredible.co.uk...] )

[edited by: encyclo at 3:14 pm (utc) on Nov. 3, 2008]
[edit reason] fixed link [/edit]


4:01 pm on Nov 18, 2008 (gmt 0)

5+ Year Member

I have been a web developer for various State of AZ agencies for years. I am very dedicated to web accessibility. I don't use accessibility technologies, though I worked with narrator turned on all the time until I got "used to it." Unfortunately some people in my office never got used to it.

Anyway, I do not use target="_blank" at all. I do use popups for movies, pdf files etc. I also provide an option to turn off the feature. In addition, the site is completely usable with JS turned off except for some "pre-me" applications which I will be rewriting. Anything that is popped up is written like this. <a href="/path/fileame.html" onclick="popupfunction(this.href); return false">link here</a>.


6:23 pm on Nov 18, 2008 (gmt 0)

5+ Year Member

Hi there, thought i would share my experiences.

For starters, target isn't in the XHTML spec, i don't know if that will affect you or not.
Second, my general rule of thumb is that i allow a target on links if it directs the user to an external site, or in your case opens a file.

From a userbility standpoint, if you do implement link that open in new windows ideally you want to put text next to that link that explains to the user that it will do just that, for example:

Click here to visit the BBC! (external site, opens in new window).

That would cover all your angles if implemented.

Also, i would like to direct your attention to an article posted by Jakob Neilson:http://www.useit.com/alertbox/20010610.html


6:26 pm on Nov 18, 2008 (gmt 0)

5+ Year Member

Whoops thought of something else (i really should think more about what i write!)

New windows breaks the content flow, navigational structure, and leads to loss of confidence in the user. You can soften the blow with my previous suggestions, but as a rule of thumb the "breaking flow" is a biggy when it comes to accessibility to the general user.


6:59 pm on Nov 18, 2008 (gmt 0)

WebmasterWorld Senior Member demaestro is a WebmasterWorld Top Contributor of All Time 10+ Year Member

Something I think a lot of you are missing is that _blank opens a new tab for a lot of users. I know my browser settings is set to open in a new tab instead of a new window.

I hate when I click a link and a PDF opens in the same window.

My rule of thumb has always been, I indicate the file type if the link is not to a webpage. But PDFs and external links always are target="_blank"

I do it that way because that is my preference when I surf. If I am on a site and it links to another site I almost always want it in a new tab. I am 34


2:30 pm on Feb 20, 2009 (gmt 0)

WebmasterWorld Senior Member piatkow is a WebmasterWorld Top Contributor of All Time 5+ Year Member

On my own site I always open a PDF in a new window/tab but always have a note beside the link saying what will happen.

I overused _blank in my less experienced days and still come across annoying little things as a result, such as the page that didn't have any navigation as my original, and forgotten, intention had been to display it as a stand alone item in a new window.


Featured Threads

Hot Threads This Week

Hot Threads This Month