Ошибка публикации новой карты Trello API - Не удалось выполнить postMessage в DOMWindow.

Я пытаюсь следовать руководству и создать новую карточку в моем списке досок Trello.

Я получаю свой ключ отсюда https://trello.com/app-key Следуя этому руководству https://developers.trello.com/get-started/start-building У меня есть моя доска открыта в отдельной вкладке. И пробовал как публичный, так и приватный режим.

Однако я получаю

Не удалось выполнить 'postMessage' в 'DOMWindow': указанное целевое происхождение ('file: //') не совпадает с источником окна получателя ('null').

В чем может быть проблема?

Это мой код:

  <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>

person Ilya Bibik    schedule 26.07.2016    source источник


Ответы (1)


Я разобрался с проблемой: нужно запускать ее с сервера, а не из локальной файловой системы. Это было так просто.

person Ilya Bibik    schedule 26.07.2016