Pop up PDFs in a new window with jQuery
Thursday, August 5th, 2010I was looking for a good way to pop up all PDF links in a new window and ran across Dennison Uy’s post with code.
Pretty slick and very unobtrusive, and it keeps target="_blank" out of your markup, which is arguably a behavioral and not structural thing anyway. Plus it’s one step closer to killing target="_blank".
My slight modification: being a tad more user friendly
Here’s my version of the code:
$("a[href*=.pdf]").click(function(){
window.open(this.href, "", "toolbar=0");
return false;
});I basically took what he did and added toolbar=0 to the arguments for window.open().
Why? Jakob Nielsen’s guidelines for opening PDFs in a new window call for removing browser chrome like the Back button. Why? Browser navigation doesn’t fit the paradigm for PDF document navigation. And Neilsen has watched thousands of users fumble around with the Web, while the rest of us have not.



October 1st, 2010 at 9:13 am
*cough*
http://github.com/rip747/popupwindow
*cough*