EasyXDM ErrorHandler 仅在 Firefox 上执行两次
我使用 easyXDM 发出跨域 POST 请求并接收响应。当请求超时时,当我在 Firefox 上运行 easyXDM 时,easyXDM 会执行 ErrorHandler 函数两次。在 Chrome 和 IE7 上它运行良好(即仅执行一次)。这是为什么?有什么想法可以预防吗?
Firefox 版本 6.0.2
EasyXDM 版本 2.4.15.118
托管在 IIS 上
示例代码(这在我的计算机上按上述方式工作,“错误”警报在 Firefox 上出现两次,在 Chrome 和 IE7 上出现一次):(显然,超时设置为低,所以它总是会发生)
<html>
<head>
<script type="text/javascript" src="easyXDM.js"></script>
<script type="text/javascript">
var rpc = new easyXDM.Rpc({
remote: "http://myserver.com/Cors.html"
}, {
remote: {
request: {}
}
});
request = {
url: "http://myserver.com/DoSomething.aspx",
method: "POST",
timeout: 1,
data: {
SomeData: "SomeInformation"
}
};
var responseHandler = function(response) {
alert("Responded");
};
var errorHandler = function(error) {
alert("Error");
};
rpc.request(request, responseHandler, errorHandler);
</script>
</head>
<body>
</body>
I use easyXDM to make cross-domain POST request and receive a response. When the request reaches a timeout, easyXDM executes the ErrorHandler function twice when I run it on Firefox. On Chrome and IE7 it works fine (i.e. just one execution). Why is that? Any ideas how can I prevent it?
Firefox version 6.0.2
EasyXDM version 2.4.15.118
Hosted on IIS
Example code (this works as described above on my computer, the "Error" alert appears twice on Firefox and once on Chrome and IE7): (obviously, the timeout is set so low so that it would always happen)
<html>
<head>
<script type="text/javascript" src="easyXDM.js"></script>
<script type="text/javascript">
var rpc = new easyXDM.Rpc({
remote: "http://myserver.com/Cors.html"
}, {
remote: {
request: {}
}
});
request = {
url: "http://myserver.com/DoSomething.aspx",
method: "POST",
timeout: 1,
data: {
SomeData: "SomeInformation"
}
};
var responseHandler = function(response) {
alert("Responded");
};
var errorHandler = function(error) {
alert("Error");
};
rpc.request(request, responseHandler, errorHandler);
</script>
</head>
<body>
</body>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此问题已在 https://github.com/oyvindkinsey/easyXDM/commit/c6da9f074606f153769d8be61aca804a02a7acb9
基于 https://groups.google.com/forum/#! 中的讨论主题/easyxdm/DI470RVe8hk
This was fixed in https://github.com/oyvindkinsey/easyXDM/commit/c6da9f074606f153769d8be61aca804a02a7acb9
based on the discussion in https://groups.google.com/forum/#!topic/easyxdm/DI470RVe8hk