I am trying to create a download link that will support all browsers
here is the code

<a href="\\servername\blah\folder\myzip.zip > downlod zip </a>

It works in IE
but chrom doesn't react to it
and firefox adds the current url to the begining of the path
can anyone help
thank you and a beautiful day

Dani AI

Generated

Quick summary for (and thanks to and for the pointers): the UNC/backslash href you posted works in IE because IE integrates with Windows file handling, but modern browsers either treat backslashes as non-standard (making the path relative) or deliberately refuse to navigate from an http(s) page to a file:/// resource for security. that’s why Chrome “does nothing” and Firefox appears to prepend the current URL. (textslashplain.com)

Practical, cross-browser fixes:

  • Best: serve the zip over HTTP(S). put the zip on a webserver (or run a tiny local server) and link with an http(s) URL; browsers will download normally and you can use the HTML5 download hint for same-origin links. quick test server (python 3):

    python -m http.server 8000

    then link to http://localhost:8000/myzip.zip. note: the download attribute only works for same-origin/blob/data URLs — it won’t make a cross-protocol file:// link behave. (developer.mozilla.org)

If you must link to a network share from an internal intranet page:

  • Use a proper file URI (UNC -> file URI mapping per RFC 8089, e.g. file://server/Share/path/file.zip or the variants some browsers accept). browsers may still block navigation from http(s) pages; check DevTools for “Not allowed to load local resource.” Enterprise fixes exist (Edge has the IntranetFileLinksEnabled policy; Firefox exposes a LocalFileLinks policy) but these require IT/GPO changes and are not workable for public sites. (datatracker.ietf.org)

TL;DR: put the zip on an HTTP(S) endpoint (or stream it from a server-side handler). that is the simplest, most-compatible solution.

Recommended Answers

All 2 Replies

thanks stbuchok, dumped in my hintslist

edit,
that bob, <== dumb as a stump ^this^ should have been in the kudo tag

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.