由于ape彗星服务器而无法使用ajax-upload [英] Can not use ajax-upload because of ape comet server

查看:133
本文介绍了由于ape彗星服务器而无法使用ajax-upload的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

第一部分说明在

First part of description is in Unsafe JavaScript attempt to access frame, when try to upload file with ajax Problem is that I get access denied error, when try to upload file with ajax-way.

经过长时间的调试,我发现如果不加载ape客户端,一切都会正常进行.猿是彗星服务器 http://www.ape-project.org/

After long debugging I have discovered that everything is working if I don't load ape client. Ape is comet server http://www.ape-project.org/

Ape使用src =" http://8.ape.readbox.cz创建iframe: 6969/?...".如果我禁用了猿并且未创建此iframe,则可以访问为ajax上传创建的iframe文档.

Ape creates an iframe with src = "http://8.ape.readbox.cz:6969/?...". If I disable ape and this iframe is not created then I have no problem to access document of the iframe, created for ajax-upload.

聚在一起看起来像

<iframe src="http://8.ape.readbox.cz:6969/?..." style="display: none; position: absolute; left: -300px; top: -300px;" id="ape_undefined"></iframe>
<iframe style="display: none;" id="ValumsAjaxUpload0" src="javascript:false;" name="ValumsAjaxUpload0"></iframe>

请,有人可以帮助我吗?我很困惑.

Please, can anybody help me? I'm confused.

推荐答案

不幸的是,我无法为您提供具体的解决方案.问题的要点如下:

Unfortunately, I can't give you a concrete solution. The gist of the problem is as follows:

为了使APE进行跨域(实际上是子域)的POST调用,猿需要重置document.domain(全局变量,窗口​​变量),摆脱域前缀(www.,beta等). ..).虽然0.ape.YOURDOMAIN.com是www.YOURDOMAIN.com的跨域限制,但允许YOURDOMAIN.com拥有同域权限.可悲的是,为了使您的上传者iframe访问父窗口,它也必须来自同一域.重置document.domain可以改变这一点.

In order for APE to make cross-domain (actually, subdomain) POST calls, ape needs to reset document.domain (a global, window variable), getting rid of the domain prefix (www., beta., etc...). While 0.ape.YOURDOMAIN.com is cross-domain restricted from www.YOURDOMAIN.com, it's allowed same-domain rights from YOURDOMAIN.com. Sadly, in order for your uploader iframe to access the parent window, it needs to be from the same domain as well. Resetting document.domain changes that.

一种解决方案是将APE的默认XHR方法从"POST"更改为"GET".您显然可以从外部域发出获取请求,但是可以发送的数据量有限.此外,您必须注释掉用于重置页面上document.domain的javascript行.

One solution is to change APE's default XHR method from 'POST' to 'GET'. You can obviously make get requests from foreign domains, but you are limited in the amount of data you can send. In addition, you would have to comment out the line of javascript that resets document.domain on your page.

这不是您可能正在寻找的出色,可靠的解决方案,但我希望它能为问题的根源提供一点启发.

This is not the great, reliable solution you are probably looking for, but i hope it sheds a little light on the source of the problem.

这篇关于由于ape彗星服务器而无法使用ajax-upload的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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