【问题标题】:Get request being aborted in Internet Explorer 9在 Internet Explorer 9 中中止获取请求
【发布时间】:2011-09-27 21:08:16
【问题描述】:

如果您专门使用 Internet Explorer 9 访问网站 lab.buffspec.com 并选择 gildan 6.1、hanes 6.1 或 gildan hood,然后单击获取定价按钮,您将看到尽管更新了数量未显示总价。在 Internet Explorer 9 中,这仅适用于这 3 件衬衫,其他的工作正常。而且这种行为只发生在 IE9 中,该站点在 Firefox 和 chrome 中运行良好。当我在 IE9 中选择开发者工具并转到网络选项卡并开始捕获时,我发现请求显示“(已中止)”,而启动器选项卡显示“(待处理)”。

有人知道这里发生了什么吗?我还没有检查过其他版本的 Internet Explorer。

另外,响应和请求都是 XML 格式的。

 public static function getPricingXml(event:NumericStepperEvent = null):XML
    {
        for each (var side:String in ['front', 'back']) {
            var workspace:Canvas = mx.core.Application.application[side + 'Workspace'];

            var colors:Array = new Array();

            for each (var e:* in workspace.getChildren()) { 
                if (e is Image && e.includeInLayout) {
                    for each (var color:String in e.colors) {
                        if (color) {
                            color = color.toLowerCase();

                            if (color && colors.indexOf(color) == -1) {
                                colors.push(color);
                            }

                        }
                    }
                }
            } 

            mx.core.Application.application[side + "TotalColors"].text = colors.length > 4 ? 4 : colors.length;
        }

        var xml:XML =   <products>
                            <product requiresUndercoat={mx.core.Application.application.color.type !== 'white'}>
                                <color hexValue={mx.core.Application.application.color.hex_color} />
                                <sides>
                                    <front totalColors={mx.core.Application.application.frontTotalColors.text} />
                                    <back totalColors={mx.core.Application.application.backTotalColors.text} />
                                </sides>
                                <sizes />
                                {mx.core.Application.application.names.getXml()}
                            </product>
                        </products>;

        var i:int = 0;
        for each (var size:Object in mx.core.Application.application.color.sizes) {
            xml.product.sizes.appendChild(<size name={size.name} abbreviation={size.abbreviation} quantity={mx.core.Application.application.priceSteppers[i++].value} price={size.price} />);
        }

        return xml;
    }

这是在单击“获取定价”按钮时构建 XML 请求的 flex 函数。

<mx:GridItem horizontalAlign="right" width="100%" fontWeight="normal" verticalAlign="middle">
                                        <mx:NumericStepper id="priceSteppers" value="0" maximum="599" fontSize="12" change="getPrices.send({ data: com.buffspec.Lab.getPricingXml(event) });" />
                                    </mx:GridItem>

这是增加数量的步进器代码,应该调用获取定价按钮。

<mx:HTTPService id="getPrices" url="http://www.buffspec.com/store/lab/getPricing.php" resultFormat="e4x" />

最后,getPrices 是一个 httpservice,它以 XML 文件的形式从http://www.buffspec.com/store/lab/getPricing.php 获取相应的结果。

我注意到请求和响应的内容类型都是“文本/纯文本”,如果这意味着什么的话。响应也是 HTTP/200,所以我不知道为什么它会被中止。

【问题讨论】:

  • 愿意分享一些代码吗?
  • 如果你能分享一些代码,它会有所帮助。同时,你可以看看这个帖子stackoverflow.com/questions/4450017/…的答案,可能是IE8和IE9上的http头问题

标签: xml apache-flex internet-explorer-9 httprequest httpresponse


【解决方案1】:

好吧,我终于想通了。通过 e4x 默认的 GET 方法发送的 URL 超过 2083 个字符,这是 Internet Explorer 的上限。当 Internet Explorer 接收到这种大小的 URL 时,它只是中止了 GET 方法的执行。希望这对遇到类似问题的人有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-08-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-01
    • 2011-05-17
    • 1970-01-01
    相关资源
    最近更新 更多