Upcoming Change to Embedded Tweet Display on Web



Hi everybody,

I’m posting this to give a heads up about a change in the pipeline that affects the embedded Tweet display on web. Currently the embedded Tweet display is rendered within a source-less iframe as a way to sandbox the Tweet UI from the host page. In the coming days, we will be switching from using a source-less iframe to shadow DOM (if the browser supports it, otherwise we will still be using a source-less iframe).

What does this change mean for you? Much lower memory utilization in the browser, and much faster render times. Tweets will appear faster and pages will scroll more smoothly, even when displaying multiple Tweets on the same page. However, please note that this means Tweets won’t always be rendered with an iframe element any more: if when selecting the embedded Tweet element you are using the iframe tag in your selector, this behavior will no longer work as expected. Rather, you should rely on the twitter-tweet class name. This approach will work for both the shadow DOM sandbox and the source-less iframe sandbox. In general, you should use this selector approach when working with any embedded Twitter display to ensure compatibility with future changes.

We’re excited to help you make your websites faster, and we’re looking forward to hearing your feedback. Please ask us any questions about this change in the Twitter for Websites forum, and we will do our best to respond over there. Thanks for using embedded Tweets!

Include platform.twitter.com/widget.js with script tag