ezrarieben / download-r

jQuery Plugin that enables file downloads directly from href in anchor tag instead of opening the file

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

download-r

A jQuery Plugin that enables downloading a file directly from a link instead of opening it

License: MIT

Setting up download-r

  1. Import the jQuery library
  2. Load the download-r script in your HTML after the body
<script type="text/javascript" src="jquery.download-r.min.js"></script>
  1. Use the following call to activate the plugin
$(document).ready(function(){
  $(document).downloadr();
});
  1. Add an <a> tag to your HTML
<a class="download-r" href="foo/bar.pdf">
Attribute Description
class Used to identify the links that are downloadable
href Link to file that is to be downloaded

Changing defaults

  1. Use JSON to change the options
    1. Example of changing the link selector class:
      $(document).downloadr({
        elements: {
          selectors: {
            link: '.download-link',
          }
        }
      });

Available options

Option Description Default value
elements.selectors.link The selector used to identify the download links .download-r

forthebadge forthebadge

About

jQuery Plugin that enables file downloads directly from href in anchor tag instead of opening the file

License:MIT License


Languages

Language:JavaScript 100.0%