javascript - 方法未捕获安全错误: Blocked a frame with origin

标签 javascript meteor

该方法似乎有问题。当安装“不安全”时,该方法内的代码工作得很好。谢谢!

未捕获的安全错误:阻止来源为“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/

相关文章:

javascript - ng-repeat 与 filter 和 ng-if 在同一元素上的 Angular 优先级

JavaScript 秒表 SetInterval 忽略 ClearInterval

javascript - 使用 Penner 缓动方程减少整数

meteor 集合在服务器上更新,不反射(reflect)在客户端

mongodb - 无法在窗口系统上的 meteor 中设置mongodb路径

javascript - 使用 Meteor 和 React 设置自定义 FB 注册时出现问题

javascript - 在移动应用程序中与 Meteor 通信 GCM 服务并实时更新应用程序数据

javascript - 用javascript检测Android(不是chrome)?

javascript - 如何将 xterm.js 与 Meteor 一起使用

javascript - 如何识别网站中js/css文件包含的来源