2

<a class="download-btn" download="" href="https://example.com/test.pdf" id="download-pdf" target="_blank">Download </a>

I have simple above download link html5 code it's not working in mozila and working fine in chrome

baj9032
  • 2,414
  • 3
  • 22
  • 40

1 Answers1

-3

use this

<a class="download-btn" download="filename.pdf" href="your file directory name put here/filename.pdf" id="download-pdf">Download </a>

please don't use website url in href tag

 wrong (https://example.com/folder name/filename.pdf )

right (../folder name/file name.pdf) 
Narendra Soni
  • 23
  • 2
  • 5
  • how its nonsense. first check this in Mozilla then tell me hows its nonsense. Download – Narendra Soni Feb 06 '18 at 12:10
  • 1
    In that it makes absolutely no difference whether you use an absolute or a relative URL ... – CBroe Feb 06 '18 at 12:12
  • first check then i will accept it ! it is nonsense – Narendra Soni Feb 06 '18 at 12:14
  • I you are of the opinion that it would make any difference whatsoever whether a relative or an absolute URL was used - then please create a proper [mcve] somewhere that actually shows this live. – CBroe Feb 06 '18 at 12:17
  • thanks for giving comment. but files are stored on S3 server so that's the region I need to mention absolute URL. – Balaji Damodare Feb 06 '18 at 12:19
  • 1
    @CBroe nitpicking but in this exact case that would actually make an huge difference since what OP is experiencing is a cross-origin restriction. A relative URL wouldn't suffer from this restriction. (looking for some dupe...) – Kaiido Feb 06 '18 at 12:30
  • 1
    @Kaiido good point, cross-origin makes the difference here. But that still doesn’t make this a good answer, because it does not mention cross-origin as the reason, but just sounds as if there was a general difference between relative and absolute URLs. – CBroe Feb 06 '18 at 12:38
  • @Kaiido https://stackoverflow.com/q/28318017/1427878 seems like an appropriate duplicate, I think. – CBroe Feb 06 '18 at 12:39
  • @CBroe yep, already closed ;-) – Kaiido Feb 06 '18 at 12:39