我有一些代码可以在 Chrome、Safari、IE 和 Opera 上正常运行。但由于某种原因,我只在 FireFox 18 上遇到这个问题
错误:访问属性“文档”的权限被拒绝 [中断此错误]
window.opener.document.getElementById("creditsTotal").innerText = 学分;
这是有问题的代码(请记住,只有 ff18 才会抛出此 XSS 错误)
chat_client.rtmp.update_chat_status = function(){
//console.log("The overridden method has been called.");
if (!this.chat.current_chat_user)
return;
this.log("Updating chat session.");
$.ajax({
url: "{% url parthenon_chat.rtmp.views.update_chat_session %}",
type: 'POST',
data: {
'session_id': this.chat.session_ids[this.chat.current_chat_user],
'csrfmiddlewaretoken': CSRF_TOKEN
},
success: function(credits) {
//make sure that credits var is integer and non-negative
var intRegex = /^\d+$/;
if(intRegex.test(credits)) {
console.log("Credits remaining: " + credits);
window.opener.document.getElementById("creditsTotal").innerText = credits;
}
}
});
有什么想法吗?我还没有尝试使用旧版本的 ff18 来查看是否会遇到相同的 XSS 异常。
最佳答案
您知道这在 Internet Explorer 中不起作用,它仅在 caniuse.com 上有部分内容
请参阅:http://caniuse.com/#feat=x-doc-messaging
你必须为 ie 做一个后备
关于javascript - 仅在 FireFox 18 上引发 XSS 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14717339/