Failed to construct 'Worker': Script at '.......' cannot be accessed from origin 'null'.
See original GitHub issueI use "vue-pdf": "^2.0.3"
in the vue spa project。After packing,on the phone, from did not use vue-pdf page(B page) to use vue-pdf page(A page),A page did not execute any code(alert , document.titile=‘123123’…),and no any DOM.]
when i open the index.html in PC Google Chrome, Failed to construct 'Worker': Script at 'file:///C:/Users/huhai/Desktop/1.0/2a59ae14c7719d1a21eb.worker.js' cannot be accessed from origin 'null'.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:14 (1 by maintainers)
Top Results From Across the Web
Failed to construct 'Worker': Script at ... cannot be accessed ...
Hello, my web-worker doesn't load in production when use different servers for app and assets 16.8e953915c614.js:1 Uncaught DOMException: ...
Read more >Chrome can't load web worker - Stack Overflow
Uncaught SecurityError : Failed to create a worker: script at '(path)/worker.js' cannot be accessed from origin 'null'. Why does this work ...
Read more >JavaScript - Google Chrome can't load web worker - Dirask
Uncaught DOMException : Failed to construct 'Worker': Script at 'file:///C://path/worker.js' cannot be accessed from origin 'null'.
Read more >Javascript – Why does not Chrome allow Web Workers to be ...
Uncaught SecurityError : Failed to create a worker: script at '(path)/worker.js' cannot be accessed from origin 'null'. But it allows them if we...
Read more >Cross domain and cross browser web workers
A web worker is a script that runs in the background in an ... Failed to construct 'Worker': Script at 'xxx' cannot be...
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 Free
Top 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
In the file
pdf.vue
try to replace
with
and compile again
My goal was to exclude the file “[hash] .worker.js” from the root of the project. But, when I tried to use
import pdf from 'vue-pdf/src/vuePdfNoSssNoWorker'
instead ofimport pdf from 'vue-pdf/src/vuePdfNoSss'
the PDF pages did not render without pdf.worker.The following configuration helped me. In ‘vuePdfNoSss.vue’: comment string:
// var PdfjsWorker = require('worker-loader!pdfjs-dist/build/pdf.worker.js');
and add to top level:import PdfjsWorker from 'pdfjs-dist/build/pdf.worker.js'
This will allow the custom configuration of ‘worker-loader’ from ‘webpack’ (in detail: https://webpack.js.org/loaders/worker-loader/).
And in ‘vue.config.js’ you need to define rule for ‘worker.js’ files in chainWebpack(config):