Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Button to download Img Src

Alright guys so i got my website working..

Now i came across the last problem.. at least i hope.

On mobile, if the user holds the image to save. They will get the actual img url on top of the context menu.

I do not want them to see that.

So my only option is to implement a download button.
I'm not sure exactly how to make a button download image src with an id tag?

If possible.
[Image: rVdyS6y.png]
h ttp :// stackoverflow (dot) com/questions/18807860/download-image-on-button-click

this seems to be exactly what you are looking for
(Dec 20, 2015 07:30 AM)Vex-Enterprises Wrote:  h ttp :// stackoverflow (dot) com/questions/18807860/download-image-on-button-click

this seems to be exactly what you are looking for

Weird, google didn't pick that one up.

Anyways although that wasn't from a button. I'll just make a button from an image and use that solution.

Thanks man!

btw welcome to the forum!


EDIT: Yeah no this won't work. You see the image will be different all the time. So that means it will contain a different image link.

I can't set up a static href.. what can i do?
[Image: rVdyS6y.png]
how are you making the image different?

would you be able to do like an <a href="" download> within the code that brings up the images?
Hey. Just read you found your solution, but I wanted to suggest a little technique you can use to not allow the user to download the image while holding it. Atleast this works on Desktop:

HTML
Code
<div id="parent">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/331810/sample6.jpg">
  <div id="overlay"></div>
</div>

CSS
Code
#parent {
  position: relative;
}
img {
  height: 300px;
  width: 500px;
}

#overlay {
  height: 300px;
  width: 500px;
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;  
}

Live preview: http://codepen.io/anon/pen/mVrdPY

There's also an HTML5 attribute called "download".

http://stackoverflow.com/questions/18924...ing-jquery

Hit me up if you need any help.


Possibly Related Threads...
Thread / Author Replies Views Last Post
by Famous DexterJul 1, 2016 12:42 PM 10 289 Jul 1, 2016 12:42 PM
Last Post: Squito
by King‎‎‎‎‎‎Oct 28, 2015 01:49 AM 6 152 Oct 28, 2015 01:49 AM
Last Post: ShizzleFly
by eXeroApr 17, 2015 03:28 PM 6 107 Apr 17, 2015 03:28 PM
Last Post: Nachfolger