什么是语法做跨域XMLHTT preQUEST到FTP服务器? [英] What is the syntax to do a cross-domain XMLHTTPREQUEST to an FTP server?

查看:195
本文介绍了什么是语法做跨域XMLHTT preQUEST到FTP服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一种WEBDAV CORS插件,我可以使用POST / PUT / GET /删除WebDAV服务器上的/ ALLDOCS文件。

I have an webDav CORS plugin, which I can use to POST/PUT/GET/REMOVE/ALLDOCS files on a webDav server.

我现在想要做同样的FTP,但我奋力 xmlhtt prequest -syntax工作(我只是得到错误 0 )。

I now want to do the same for FTP, but I'm struggling to get the xmlhttprequest-syntax to work (I'm just getting error 0 ).

此页面上的Mozilla说,这是可以使用 xmlhtt prequests 文件和ftp为好,但我不能找到工作的例子或教程的任何地方。

This page on Mozilla says it's possible to use xmlhttprequests for file and ftp as well, but I cannot find a working example or tutorial anywhere.

这是我尝试,它返回到受限制的URI被拒绝访问

This is what I'm trying, which returns access to restricted URI denied

function reqListener () {
  console.log(this.responseText);
}

var oReq = new XMLHttpRequest();
oReq.onload = reqListener;
oReq.open("GET", "ftp://<username>:<passeword>@mydomain.de/folder/test.txt", true);
oReq.send();

我也尝试了常规的Ajax请求

I also tried a regular Ajax request

$.ajax({
  url: "ftp://sharedspace.domain.provider.com/folder/test.txt",
  type: "GET",
  async: true,
  dataType: "text",
  crossdomain : true,
  headers : {
    user: "<username>",
    password: "<password>"
  },
  success: function(e){
    console.log("success");
    console.log(e);
  },
  error: function(e){
    console.log("error");
    console.log(e);
  },
}); 

这也不起作用,返回 0 状态code。

问题
什么是正确的语法做跨域 XMLHTT preQUEST FTP

Question:
What is the correct syntax to do a cross-domain XMLHTTPREQUEST for FTP.

谢谢!

编辑:
我发现的唯一有用的链接此网页。这里 ,但它只是星星点点的信息片段,我不能砌在一起。


The only useful link I found is this page here, but it's just bits and pieces of information and I couldn't puzzle them together.

修改
也许也是有用的链接

EDIT
Maybe also useful link

推荐答案

虽然Mozilla的MDN文档引用xmlHtt prequest配套文件和ftp没有主流浏览器做AFAIK。这就是为什么你需要从某种服务器的服务于您的Web项目的原因之一,即使是在同一台机器上,如果你想开发/测试任何xmlHtt prequest的东西,因为文件:// 不能正常工作

Although the Mozilla MDN docs reference xmlHttpRequest supporting file and ftp none of the major browsers do AFAIK. It is one of the reasons why you need to serve your web projects from some sort of server, even if it is on the same machine, if you want to develop/test any xmlHttpRequest stuff since file:// doesn't work.

微软特别指出<一href="http://blogs.msdn.com/b/ieinternals/archive/2009/07/23/the-ie8-native-xmlhtt$p$pquest-object.aspx">IE只支持HTTP / HTTPS 。 W3C规范它也说,规范仅适用于HTTP / HTTPS 但'一些实现支持除了协议,HTTP和HTTPS,但功能不属于本说明书的。

Microsoft specifically states that IE only supports http/https. The W3C spec for it also says that the spec is only for HTTP/HTTPS but that 'some implementations support protocols in addition to HTTP and HTTPS, but that functionality is not covered by this specification'.

至于CORS,它是专门只为HTTP / HTTPS。该规范是所有有关使用HTTP标头。见W3C规范这里。 FTP没有任何同等类型的标题为HTTP。

As for CORS, it is specifically only for HTTP/HTTPS. The spec is all about using HTTP headers. See the W3C spec here. FTP doesn't have any equivalent type of header as HTTP.

这篇关于什么是语法做跨域XMLHTT preQUEST到FTP服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆