How can I force the button to give the client a file (local) via js
Because I can't use the <a href="..."> -> server generates 404 error
-> ...">
How can I force the button to give the client a file (local) via js
Because I can't use the <a href="..."> -> server generates 404 error
404 means that there is nothing on this link, try to check the correctness of the address, as for me it’s already reinventing the wheel via js
As far as I understand it is a local file on a computer with a browser. Historically, the file: // protocol was used for this, but if the page is open from the server (via http), then for security it will not allow such a transition.
code
<a href="" onclick="location.href='file:///d:\\t.txt'; return false;">test</a> works for example in chrome, if the file itself, which contains it, is also located locally. for Ineta, you need to play with the security level for the site and there may be a different approach to interpretation in different browsers. but without security settings will not work exactly. so for the "public" option will not work.
Can you clarify some nuances, where is the page that you opened? it is on the server or you have it locally, because you are saying to give it to the client - it means that the site is on the server, and you are trying to give the file that you have locally. not affiliated with the server. Actually, therefore, it gives 404 error
Maybe I misunderstood your description?
Source: https://ru.stackoverflow.com/questions/483172/
All Articles
404because there is no file along this path .... but you can always write a<a href="/path/to/your/file.ext">файл</a>and it will all be downloaded .. for example: codepen.io/ anon / pen / zrEzPy - Alexey Shimanskydata=new Blob(["\ufeff",[data]],{type:' _myme type_'}); var file=window.URL.createObjectURL(data);data=new Blob(["\ufeff",[data]],{type:' _myme type_'}); var file=window.URL.createObjectURL(data);then the contents of thefilecan be substituted as href into the link to the created file, add the attribute from the previous comment there, and voila - the file can be made directly in the browser on js and sent for download using html. - Darth