Worker cannot be imported from different origin.
See original GitHub issueWhat are you trying to achieve? Please describe.
I have a web page under domain.com that uses a CDN for the JS files, the problem is that the origin is different then when I tri to import the worker Chrome says: Uncaught DOMException: Failed to construct ‘Worker’ ‘https://cdn.com’ cannot be accessed from origin ‘https:domain.com’ and CORS are well configured.
I’m using this import
import { Document } from 'react-pdf/dist/esm/entry.webpack';
This is not happening in Firefox
Describe solutions you’ve tried
I tried to use a subdomain for the CDN like cdn.domain.com but not working neither.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:8
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Execute web worker from different origin - Stack Overflow
A solution would be to place the worker on www.myotherdomain.com or place a proxy file (which simply loads the worker from the cdn...
Read more >Cross domain and cross browser web workers
You are limited by the same origin policy i.e. the worker script must be served from the same domain (including the protocol) as...
Read more >Chapter 13 - Country of Origin Marking
Canada, Mexico and the United States shall exempt from country of origin marking requirements a good of another NAFTA country that: is a...
Read more >Service Workers - W3C
A user agent may enable many service worker registrations at a single origin so long as the scope url of the service worker...
Read more >Cross-Browser support with Cross-Origin isolation
Let's explore the journey of cross-origin isolation together. ... inside a Web Worker and importing a script with a script tag.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Well, you shouldn’t do that. Loading scripts from different origins is usually a bad idea.
Am also facing the same kind of error while loading the worker from different origin.