0

I need to download a file from an internal server different than the one the site will be sitting on. I've tried the following...

<a href="javascript:Start('file://servername/path/filename.txt')>

<a href="//servername/path/filename.txt" download="filename.txt">

<a href="\\servername\path\filename.txt" download="filename.txt">

<a href="https://servername/path/filename.txt" download="filename.txt">

<a href="ftp://servername/path/filename.txt" download="filename.txt">

None seem to be working. Any ideas?

Fiddle Freak
  • 1,923
  • 5
  • 43
  • 83
  • What do you mean by internal server? Web server? FTP server? File server? Have you tried `href="file://servername...`. Is the problem with the path or the download attribute? – j08691 Mar 12 '20 at 18:16
  • server where the file is accessed via smb or in windows \\servername\path\filename, and yeah I tried that and it isn't working. – Fiddle Freak Mar 12 '20 at 18:19

2 Answers2

0

The documentation says that the download tag only works :

for same-origin URLs, or the blob: and data: schemes.

So you cannot make it work with the download tag

Seblor
  • 6,947
  • 1
  • 25
  • 46
  • Thanks, is there a good way to make it work without the download tag, or must the file be stored in the same website directory? – Fiddle Freak Mar 12 '20 at 18:17
  • You can always try to find workaround with JavaScript and by using the blob scheme with some fiddling. – Seblor Mar 12 '20 at 18:18
0
  • Browsers generally block access to file: URLs from pages loaded over http: (or https:)
  • Linking to files over Windows File & Print Sharing requires file: URLs
  • The download attribute doesn't have any effect cross-origin

So:

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335