该方法似乎有问题。当安装“不安全”时,该方法内的代码工作得很好。谢谢!
未捕获的安全错误:阻止来源为“http://localhost:3000”的框架访问来源为“chrome-extension://oknpjjbmpnndlpmnhmekjpocelpnlfdi”的框架。请求访问的帧具有“http”协议(protocol),被访问的帧具有“chrome-extension”协议(protocol)。协议(protocol)必须匹配。
模板事件
Template.docEdit.events({
'click .remove': function(event, template) {
var thisTag = String(this);
Meteor.call('removeTag', template, thisTag);
},
});
方法
Meteor.methods({
removeTag: function(template, thisTag) {
MyPix.update (
template.data._id,
{ $pull: { 'metadata.tags': thisTag }}
);
}
})
这确实适用于添加“不安全”
Template.docEdit.events({
'click .remove': function(event, template) {
var thisTag = String(this);
MyPix.update (
template.data._id,
{ $pull: { 'metadata.tags': thisTag }}
);
}
});
最佳答案
好的,我传递了整个模板。该方法只需要 id。
模板事件
Template.docEdit.events({
'click .remove': function(event, template) {
var thisTag = String(this);
var thisId = template.data._id; // assign id to var
Meteor.call('removeTag', thisId, thisTag);
},
});
方法
Meteor.methods({
removeTag: function(thisId, thisTag) {
MyPix.update (
thisId,
{ $pull: { 'metadata.tags': thisTag }}
);
},
})
关于javascript - 方法未捕获安全错误: Blocked a frame with origin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28625564/