流星方法在 mozilla 中无法正常工作

Meteor method not working properly in mozilla

我正在尝试调用流星方法,在将用户重定向到相关 url(使用生成的文档 _id)之前插入文档。

目前的代码适用于 chromium 但不适用于 firefox,在 firefox 上它似乎只是立即被重定向而没有实际插入任何东西。

我在底部附上了我的代码。谁能告诉我出了什么问题,我该怎么做才能解决?为什么 chrome 和 firefox 在这种情况下会有不同的表现?

非常感谢提供的任何帮助!

client.js

newDoc(){
    Meteor.call('addDoc',{
      // some parameters
    })
  }

clientandserver.js(流星法)

'addDoc'(obj){
    console.log(obj); // does not output anything on firefox
    DocumentData.insert({
      //some parameters
    },function(err,documentID){
      if (Meteor.isClient){
        window.location = '/docs/' + documentID;
        // redirection happens before insertion on firefox
      }
    });
  }

window.location带到客户端。喜欢:

newDoc(){
   Meteor.call('addDoc', data, function(error, result){
     if(result){
        window.location = '/docs/' + documentID;
     }
  })
}

并且只在服务器端插入,例如:

'addDoc'(obj){
    return DocumentData.insert({
      //some parameters
    });
  }

我使用过这种结构,它在 Firefox 和 Chrome 中都适用。