Coder Social home page Coder Social logo

downloadbyurl's Introduction

chrome / safari

chrome

firefox

firefox

ie

ie

English

downloadByUrl

This repository is created based on the https://github.com/PixelsCommander/Download-File-JS package

demo

click

Advantages

  • Not blocked by the browser after the ajax request
  • Compatible with Chrome, Firefox, Safari, IE (at least IE5 or above)
  • 2kb size

Download

npm i downloadbyurl

Usage

window.downloadByUrl('./test.jpg')

or

import downloadByUrl from 'downloadbyurl'
downloadByUrl('./test.jpg')

Result

const result = downloadByUrl('./test.jpg')
// If some pictures are not allowed to be downloaded, they will not be downloaded and cannot be detected.
if(result){
    alert('success')
}

License

MIT

中文

downloadByUrl

此存储库基于 https://github.com/PixelsCommander/Download-File-JS 包创建

例子

点击

优点

  • 在 ajax 请求后,不被浏览器拦截
  • 兼容 Chrome,Firefox,Safari,IE(至少 IE5 以上)
  • 2kb 大小

下载

npm i downloadbyurl

用法

window.downloadByUrl('./test.jpg')

或者

import downloadByUrl from 'downloadbyurl'
downloadByUrl('./test.jpg')

结果

const result = downloadByUrl('./test.jpg')
//  如果是某些头部不被允许下载的图片,会出现无法下载的情况,且无法被侦测
if(result){
    alert('下载成功')
}

许可证

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.