Quantcast
Channel: User Sergey Ponomarev - Stack Overflow
Viewing all articles
Browse latest Browse all 58

Answer by Sergey Ponomarev for get a file from a webdav directory with XMLHttpRequest()

$
0
0

If your JS is on the same domain (origin) e.g. you fetching the file from your site then you don't need CORS. But if you wish to download/get the file feom other website thalen that site should allow it with CORS.The CORS headers are not so easy to configure and you have to read docs.Also please note that your site and destination should use https because requests from plain http will be blocked by a browser to avoid insecure leaks.

You can fetch the file with just GET https://example.com/ file.pdf as a usual. The WebDAV by itself only adds PROPFIND to list files in a directory and MKCOL to create a directory plus COPY/MOVE.

Also please note that PDF is a binary format and you need for some JS library to parse it


Viewing all articles
Browse latest Browse all 58

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>