Created
May 3, 2016 09:46
-
-
Save ajitbohra/111136e9f5033aaa4004e2b34a98f704 to your computer and use it in GitHub Desktop.
Force PDF Download
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Forces all PDF links to download automatically, if the browser supports it. | |
* Otherwise, open the link in a new browser window or tab. | |
*/ | |
jQuery(document).ready(function($) { | |
$('a[href$=".pdf"]') | |
.attr('download', '') | |
.attr('target', '_blank'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment