Welcome to Wimbledon IT
Your provider for quality websites with a good customer serivce
Go to Portfolio

What customers say

I sitll cant belive how fast and professional Wimbledon IT was.
Marc H.
I should have contacted wimbledon-it much earlier - very reliable and fast. Very friendly support in real life, via e-mail or on the telephone.
Amy W.

Latest News

Open PDFs in new tabs
Posted on: 2nd March 2012Posted in: Development, Quicktip

Open PDFs in new tabs

Considering you are using jQuery on your project this will help you to open all PDF files automatically in a new tab.

//Make pdf's open in _blank
    $('a').click( function( ){
        var link = $(this).attr("href");

        if( link.search( "(\.pdf)" ) > -1){
            //This is a pdf link!
            $(this).attr("target", "_blank");
        }
    } );

What does it do?

It creates an event listener on all links. It then looks at the href attribute of the link that was clicked.

If it finds “.pdf” at the end of the string it adds the target “_blank”. This causes the browser to open a new tab to display / download the PDF.