createTweet returns a Promise on Chrome 52 doesn't call "then" function

embeddedtweet

#1

My site calls createTweet function through other domain site.

client (my site) – load as iframe --> CloudFront (html) – call --> twitter embed API

I could receive then callback using createTweet function until Chrome 51.
But after Chrome 52, the promise doesn’t call “then” function.
Firefox and Safari works fine.

I watched the promise status by returning createTweet value,

var tw = twttr.widgets.createTweet(
    id,
    document.getElementById("container")
);
setInterval(function() {
  console.log(tw);
}, 1000);

Promise {[[PromiseStatus]]: “pending”, [[PromiseValue]]: undefined}
Promise {[[PromiseStatus]]: “pending”, [[PromiseValue]]: undefined}
Promise {[[PromiseStatus]]: “pending”, [[PromiseValue]]: undefined}

Status was much pending.

When I directly access html on CloudFront, it works fine.

Promise {[[PromiseStatus]]: “resolved”, [[PromiseValue]]: twitterwidget#twitter-widget-0.twitter-tweet.twitter-tweet-rendered}

In additional, I tried directly to use Promise on the html.
The code works well.

var p = new Promise(
  function(resolve, reject) {
    resolve(100);
  }
);
p.then(
  function(v) {
    console.log(v);
  }
);

Embedding tweets on android chrome browser does not works
#2

I found a solution by setting 1px height for iframe.
Chrome 52 would not allow 0px height, but I couldn’t find the changelog.

Thanks anyway


#3

OK, glad you got it working, and thanks for sharing the solution! :thumbsup:


#4