Open All Links to PDF files in a New Window

This finds all of the links pointing to PDF files and opens them in a new window. If you are using Chrome, you will need to enable popups for this to work.

$("a[href$='.pdf']").each(function () {$(this).attr('href'),"_blank");


Written by: Jake Lett
I share digital marketing tips and HubSpot tutorials to help marketers and business owners grow their business.


Related posts


Want to Get Email Updates of New Articles?

Join My Email Newsletter