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

shadow-dom

#1

Hi,

when I include widget.js in a script tag like that :
<script type='text/javascript' src='//platform.twitter.com/widgets.js'></script>

I test it in a simple html page :
<html> <head> <title>Twitter test</title> <script type='text/javascript' src='//platform.twitter.com/widgets.js'></script> </head> <body> test </body> </html>

I have the following error :
widgets.js:10 Uncaught TypeError: Cannot read property ‘createShadowRoot’ of null

It worked one or two weeks ago and now there is this error. Any idea ?

Thank you


#2

Hello,

Could you please provide a link to the ‘test’ page, as no code is visible in your post.


#3

Hello,

thank you for your reply, I have fixed my previous post. (My html test page is not online)


#4

What browser are you using?

We recently switched to using Shadow DOM for rendering embedded Tweets.


#5

If it’s of any use, Andy, I’ve just replicated the problem too using Google Chrome (Version 51.0.2704.36 beta-m).


#6

On mac :

  • With Chrome 50.0.2661.94, i have this error :
    widgets.js:10 Uncaught TypeError: Cannot read property ‘createShadowRoot’ of null
  • With Firefox 46, this one :
    TypeError: o.body is null
  • With Safari 9.1 :
    TypeError: null is not an object (evaluating ‘o.body.createShadowRoot’)

#7

The same problem. Version 50.0.2661.94 m

It happens on some websites. Not all of them.


#8

I’m seeing this on my site as well.

Chrome 50.0.2661.94


#9

In Chrome Canary : Version 52.0.2730.0 canary
widgets.js:9 Refused to apply inline style because it violates the following Content Security Policy directive: “style-src https:”. Either the ‘unsafe-inline’ keyword, a hash (‘sha256-taZolPWII8ML6ATacXLbECNoYsc2N7hLDB526X3Yslw=’), or a nonce (‘nonce-…’) is required to enable inline execution.
i @ widgets.js:9


#10

Also the effect in FF and Chrome is an Unstyled Tweet Button


#11

Thanks for all the information here - the web team will take a look when they can.


#12

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.