我正在尝试按照教程进行操作,并在Trello面板列表中创建一张新卡。
我从这里获取我的钥匙https://trello.com/app-key
遵循本教程https://developers.trello.com/get-started/start-building
我在单独的选项卡中打开了董事会。并尝试了公共和私有模式。
但是,我越来越
无法在“ DOMWindow”上执行“ postMessage”:目标来源
提供的('file://')与收件人窗口的来源不匹配
('空值')。
可能是什么问题呢?
这是我的代码:
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="https://api.trello.com/1/client.js?key=MyKey"></script>
<body>
<script>
var authenticationSuccess = function() { console.log('Successful authentication'); };
var authenticationFailure = function() { console.log('Failed authentication'); };
Trello.authorize({
type: 'popup',
name: 'Getting Started Application',
scope: {
read: true,
write: true },
expiration: 'never',
success: authenticationSuccess,
error: authenticationFailure
});
var myList = 'Mylist';
var creationSuccess = function(data) {
console.log('Card created successfully. Data returned:' + JSON.stringify(data));
};
var newCard = {
name: 'New Test Card',
desc: 'This is the description of our new card.',
// Place this card at the top of our list
idList: myList,
pos: 'top'
};
Trello.post('/cards/', newCard, creationSuccess);
</script>
最佳答案
我发现了问题。您必须从服务器而不是本地文件系统执行它。就这么简单。
关于javascript - Trello API发布新卡错误-无法在“DOMWindow”上执行“postMessage”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/38592186/