最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Error: Permission denied to access property 'nodeType' on AJAX request in Firefox - Stack Overflow

programmeradmin5浏览0评论

I include the Google Sign-in button on my page, and use gapi to interact with it. When the user successfully authenticates using the Google API , I make an AJAX call using JQuery to my server:

var token = gapi.auth.getToken();
var data = {
    "token": token,
    "userId": googleResponse.id
};
console.log("sending data");
console.log(data);
$.post(url, data, function(response) {
                window.location.reload();
            }, "json").error(function(responseObj, statusCode) {
                var response = responseObj.responseJSON;
                console.log("error");
                console.log(response);
                console.log(statusCode);
            });

I see this issue in the console:

"sending data"

Object { token: Object, userId: "xxxxxxxxxxxxxxx" }

Error: Permission denied to access property 'nodeType'

The page does not reload and I do not see additional info in the console.

I do not use JQuery to access any element properties or manipulate the DOM in any way.

This issue happens with Firefox 36.0.1 and JQuery 2.1.1, but not with Chrome or Safari (same page, same code), on my Mac.

EDIT There were posts suggesting FireBug is to blame, so I disabled it and restarted Firefox, but it didn't help.

I include the Google Sign-in button on my page, and use gapi to interact with it. When the user successfully authenticates using the Google API , I make an AJAX call using JQuery to my server:

var token = gapi.auth.getToken();
var data = {
    "token": token,
    "userId": googleResponse.id
};
console.log("sending data");
console.log(data);
$.post(url, data, function(response) {
                window.location.reload();
            }, "json").error(function(responseObj, statusCode) {
                var response = responseObj.responseJSON;
                console.log("error");
                console.log(response);
                console.log(statusCode);
            });

I see this issue in the console:

"sending data"

Object { token: Object, userId: "xxxxxxxxxxxxxxx" }

Error: Permission denied to access property 'nodeType'

The page does not reload and I do not see additional info in the console.

I do not use JQuery to access any element properties or manipulate the DOM in any way.

This issue happens with Firefox 36.0.1 and JQuery 2.1.1, but not with Chrome or Safari (same page, same code), on my Mac.

EDIT There were posts suggesting FireBug is to blame, so I disabled it and restarted Firefox, but it didn't help.

Share Improve this question edited Jun 20, 2020 at 9:12 CommunityBot 11 silver badge asked Mar 9, 2015 at 18:17 Daniel KatsDaniel Kats 5,57415 gold badges72 silver badges113 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

I figured this out by taking a closer look at the token object I was sending: the token object contains a field called g-oauth-window, which contains a reference to the DOM object which created it. When you pass this token inside of a $.post request, JQuery will resolve this field, and it makes Firefox bug out. Blanking out this field (setting it to null) makes everything work!

发布评论

评论列表(0)

  1. 暂无评论