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);
}
);