https://github.com/ezrarieben/download-r
jQuery Plugin that enables file downloads directly from href in anchor tag instead of opening the file
https://github.com/ezrarieben/download-r
direct-download-link download-file download-link download-links downloader file-download file-downloader filedownload jquery jquery-plugin link links
Last synced: about 2 months ago
JSON representation
jQuery Plugin that enables file downloads directly from href in anchor tag instead of opening the file
- Host: GitHub
- URL: https://github.com/ezrarieben/download-r
- Owner: ezrarieben
- License: mit
- Created: 2019-03-12T11:00:34.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-13T15:11:23.000Z (over 6 years ago)
- Last Synced: 2025-06-24T03:13:25.631Z (5 months ago)
- Topics: direct-download-link, download-file, download-link, download-links, downloader, file-download, file-downloader, filedownload, jquery, jquery-plugin, link, links
- Language: JavaScript
- Homepage:
- Size: 11.7 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# download-r
A jQuery Plugin that enables downloading a file directly from a link instead of opening it
[](https://opensource.org/licenses/MIT)
## Setting up download-r
1. Import the [jQuery library](https://www.google.com "jQuery's CDN Page")
2. Load the download-r script in your HTML after the body
```html
```
3. Use the following call to activate the plugin
```javascript
$(document).ready(function(){
$(document).downloadr();
});
```
4. Add an [``](https://www.w3schools.com/tags/tag_a.asp "W3Schools A tag explenation") tag to your HTML
```html
```
| 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:
```javascript
$(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` |
---
[](https://forthebadge.com)
[](https://forthebadge.com)