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 () {
   window.open($(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.

Topic:

Related posts

Tags:

Want to Get Email Updates of New Articles?

Join My Email Newsletter