Ajax请求未在Firefox中发送未知错误

时间:2022-10-07 16:12:48

When doing this GET synchronous ajax request in Firefox 27.0.1, Fedora 20, jQuery 1.11.0:

这样做时,在Firefox 27.0.1、Fedora 20、jQuery 1.11.0中获取同步ajax请求:

$.ajax(ajaxParam).then(
    function (r) {
        html = r.html;
    },
    function (jqXHR) {
        console.log(JSON.stringify([jqXHR, $.ajaxSettings, ajaxParam], null, 4));
    }
);

it works in Chrome 33.0.1750.146 for Linux but in Firefox no request is sent to the server and it errors out:

它在Chrome 33.0.1750.146中适用于Linux,但在Firefox中没有发送请求给服务器,并出现错误:

[
    {
        "readyState": 0,
        "status": 0,
        "statusText": "[Exception... \"<no message>\"  nsresult: \"0x805e0006 (<unknown>)\"  location: \"JS frame :: http://example.com/static/jquery-1.11.0.min.js :: .send :: line 4\"  data: no]"
    },
    {
        "url": "http://example.com/pt/BR",
        "type": "GET",
        "isLocal": false,
        "global": true,
        "processData": true,
        "async": true,
        "contentType": "application/x-www-form-urlencoded; charset=UTF-8",
        "accepts": {
            "*": "*/*",
            "text": "text/plain",
            "html": "text/html",
            "xml": "application/xml, text/xml",
            "json": "application/json, text/javascript",
            "script": "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
        },
        "contents": {
            "xml": {},
            "html": {},
            "json": {},
            "script": {}
        },
        "responseFields": {
            "xml": "responseXML",
            "text": "responseText",
            "json": "responseJSON"
        },
        "converters": {
            "text html": true
        },
        "flatOptions": {
            "url": true,
            "context": true
        },
        "jsonp": "callback",
        "cache": false,
        "traditional": true,
        "dataType": "json"
    },
    {
        "url": "/advert/pt/BR",
        "data": {
            "realty_id": "2"
        },
        "async": false,
        "type": "GET"
    }
]

The nserror 0x805e0006 is NS_ERROR_CONTENT_BLOCKED

nserror 0x805e0006是NS_ERROR_CONTENT_BLOCKED


Answering to epascarello

回答,epascarello

That ajax call is inside this function

ajax调用在这个函数中。

function popupOpen(params, page, html) {
    loadScripts();
    var ajaxParam = {
            url: '/' + page.url + '/' + $('#lang_code').val() + '/' + $('#terr_code').val(),
            data: params,
            async: false,
            type: page.method,
            traditional: false
        },
        realtyId = params.realty_id;
    if (!html) {
        $.ajax(ajaxParam).then(
            function (r) {
                html = r.html;
            },
            function (jqXHR) {
                console.log(jqXHR, $.ajaxSettings, ajaxParam);
            }
        );
    }

and popupOpen is called by a click listener in a Google map

popupOpen是在谷歌映射中通过单击监听器调用的。

gm.event.addListener(marker[realtyId], 'click', function () {
    infoWindow[realtyId].open(map, marker[realtyId]);
    popupOpen({ realty_id: realtyId }, realtyId === 0 ? pageO.modify : pageO.advert);
});

2 个解决方案

#1


12  

Since the target url had the advert world Adblock Plus was blocking it. Good it happened to me before going in production.

由于目标url有广告世界Adblock Plus正在阻塞它。很好,这是我在投产前发生的事。

#2


0  

I had a similar issue in node.js where my route was /api/getads and the AJAX call was hit the error logic before it even went to the server. Changing the route url to /api/getspn (spn short for Sponsor) fixed the issue.

我在node有一个类似的问题。我的路径是/api/getads和AJAX调用在错误逻辑到达服务器之前就被击中了。将路由url更改为/api/getspn(赞助商的缩写)解决了这个问题。

Do not use URL's or routes that contain "ads" because it will conflict with Anti-Adware plugins for Firefox.

不要使用包含“广告”的URL或路由,因为它会与Firefox的反插件插件发生冲突。

#1


12  

Since the target url had the advert world Adblock Plus was blocking it. Good it happened to me before going in production.

由于目标url有广告世界Adblock Plus正在阻塞它。很好,这是我在投产前发生的事。

#2


0  

I had a similar issue in node.js where my route was /api/getads and the AJAX call was hit the error logic before it even went to the server. Changing the route url to /api/getspn (spn short for Sponsor) fixed the issue.

我在node有一个类似的问题。我的路径是/api/getads和AJAX调用在错误逻辑到达服务器之前就被击中了。将路由url更改为/api/getspn(赞助商的缩写)解决了这个问题。

Do not use URL's or routes that contain "ads" because it will conflict with Anti-Adware plugins for Firefox.

不要使用包含“广告”的URL或路由,因为它会与Firefox的反插件插件发生冲突。