Hi, we’re using the Twitter for Websites JavaScript API, and are trying to import dynamically https://platform.twitter.com/widgets.js. The problem is that dynamic imports require CORS:
https://platform.twitter.com/widgets.js
Access to script at ‘https://platform.twitter.com/widgets.js’ from origin ‘http://localhost:1234’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
Can Twitter please set the appropriate headers? Thanks!
Hello @CryptoClimate,
Can you please provide the code & browser/version you’re using to try to dynamically import widgets.js so we can look into this further?
Thanks!
I’m using Chromium 71 (Firefox doesn’t support dynamic imports) and the code is simply
import('https://platform.twitter.com/widgets.js').then(() => console.log('import worked'));
Here’s a jsbin showing dynamic import working for jQuery and failing for the widget.js.