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 badges1 Answer
Reset to default 6I 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!