Save an image to the local folder from the website by clicking a link or button in mobile browser

早过忘川 提交于 2019-12-13 04:13:06

问题


How can I save an image from the webpage by clicking on a link in smart phone, using JavaScript, jQuery or using HTML controls?

The sample code is as follows:

<a href="">Save image</a> 
<!--The Link to save the image-->
<img src"../images/logo.png" alt="Logo" height="50" width="50" /> 
<!--The Image that I wanted to save-->`

Now, I want to save the image logo.png in my local folder, by clicking on the link in smart phones (iPhone 4+, Android 2.1+ and BlackBerry 6+)?


回答1:


Usually browsers have their own handling when you click a link which points directly to a downloadable file: either asks you where you want to save it, or it downloads the file to a predefined location. I'm not sure if you can override this.




回答2:


For example, iOS shows you the prompt to save the file when you press and hold onto the image. I don't think that you could do that just like in a desktop browser, like httprequest or response.binarywrite (c#).



来源:https://stackoverflow.com/questions/9130258/save-an-image-to-the-local-folder-from-the-website-by-clicking-a-link-or-button

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!