CORS headers for `widgets.js`



Hi, we’re using the Twitter for Websites JavaScript API, and are trying to import dynamically The problem is that dynamic imports require CORS:

Access to script at ‘’ 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?



I’m using Chromium 71 (Firefox doesn’t support dynamic imports) and the code is simply

import('').then(() => console.log('import worked'));

Here’s a jsbin showing dynamic import working for jQuery and failing for the widget.js.

closed #4

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


Hi @CryptoClimate,

Can you try this now and let us know if you run into any other issues? The CORS issue should be resolved.