Answer the question
In order to leave comments, you need to log in
How to download an .htm file from a server using JavaScript using the FTP protocol?
There is a task to make a standalone Widget / Informer for displaying weather data, which will be embedded on third-party sites through the "iframe" tag.
As weather data, there is a file on the server, access to which is via the FTP protocol.
You need to download this file via ftp using Javascript.
As a possible solution, I found XMLHttpRequest, the official site states that this API has support for FTP Requests, but I did not manage to download the file using it.
Here is the sample code I used:
const xhr = new XMLHttpRequest();
xhr.open('GET', 'ftp://SITE.COM/PATH/FILE.htm', false, 'LOGIN, 'PASSWORD');
xhr.send();
Answer the question
In order to leave comments, you need to log in
How to make a background like this?
background
Nothing from the browser. The browser does not provide an API for working with FTP.
The name of the XMLHttpRequest function shows that this is an HTTP request and not an FTP request. Although some documentation, such as Mozilla, mentions that it is possible to connect to FTP, in reality, no browser supports this specification at the JavaScript executor level.
In other words, the answer to your question is no way.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question