Title: Dynamically webview resources fail to load in some browser/OS combinations · Issue #3410 · coder/code-server · GitHub
Open Graph Title: Dynamically webview resources fail to load in some browser/OS combinations · Issue #3410 · coder/code-server
X Title: Dynamically webview resources fail to load in some browser/OS combinations · Issue #3410 · coder/code-server
Description: VS Code in the browser. Contribute to coder/code-server development by creating an account on GitHub.
Open Graph Description: VS Code in the browser. Contribute to coder/code-server development by creating an account on GitHub.
X Description: VS Code in the browser. Contribute to coder/code-server development by creating an account on GitHub.
Opengraph URL: https://github.com/coder/code-server
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Dynamically webview resources fail to load in some browser/OS combinations","articleBody":"Hi, I have two issues, they may all be related to https certificates.\r\n\r\n- One is `code-server` prompt can‘t register serviceworker error\r\n- The other is that I can't `load resources dynamically` on my expansion webview.\r\n\r\nI run `code-server --host 0.0.0.0 --port 8223 --cert` in docker `ubuntu:20.04`, and expose `8223` in my Windows 10 host, but I get an ssl error when I open a exntesion webview in code-server in my company.\r\n\r\nwhen I use `Chrome command line` \"**--ignore-certificate-errors**\", my extension webview can't dynamic loading of resources(eg. js, css), which cause the page style confusion, the Chrome dev tool network display the resource keep pending until it fails.\r\n\r\nAt first, I thought it was the invalid certificate problem,but even if I use a valid certificate, I **still** can't dynamic loading resources.(**Without any certificate errors and any Chrome command line options**)\r\n\r\nI use something like this to dynamic loading resources\r\n```\r\n function addCss(path, callback) {\r\n if(!checkcache(path)) { /*Check if it has been loaded*/\r\n var head = dom.getElementsByTagName('head')[0];\r\n var link = dom.createElement('link');\r\n link.href = path;\r\n link.rel = 'stylesheet';\r\n link.type = 'text/css';\r\n head.appendChild(link); /*Add to HTML*/\r\n link.onload = link.onreadystatechange = function() { /*whether the loading is successful*/\r\n if(!this.readyState || this.readyState === \"loaded\" || this.readyState === \"complete\") {\r\n link.onload = link.onreadystatechange = null;\r\n callback();\r\n }\r\n };\r\n cache[path] = 1; /*Store loaded paths*/\r\n }\r\n };\r\n```\r\n\r\n-->\r\n\r\n## OS/Web Information\r\n\r\n- Web Browser: Chrome 90.0.4430.212 64bit\r\n- Local OS: Windows 10\r\n- Remote OS: ubuntu:20.04 (docker)\r\n- Remote Architecture: x86\r\n- `code-server --version`: 3.9.0\r\n\r\n## Steps to Reproduce\r\n\r\n1. installl code-server 3.9.0 in docker ubuntu:20.04\r\n2. code-server --host 0.0.0.0 --port 8223 --cert\r\n3. enter localhost:8888 and open my extension webview\r\n\r\n## Expected\r\n\r\nNo error.\r\n\r\n## Actual\r\n\r\nget an error in bottom right corner:\r\n```\r\nError loading webview: Could not register service workers: SecurityError: Failed to register a ServiceWorker for scope ('https://localhost:8223/webview/') with script ('https://localhost:8223/webview/service-worker.js'): An SSL certificate error occurred when fetching the script.\r\n```\r\n\r\n\r\n## Screenshot\r\n\r\n\r\n\r\n\r\n\r\n\r\n","author":{"url":"https://github.com/chouzz","@type":"Person","name":"chouzz"},"datePublished":"2021-05-18T13:10:51Z","url":"https://github.com/coder/code-server/issues/3410"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/issues/:id(.:format) |
| route-controller | issues |
| route-action | show |
| fetch-nonce | v2:9751ff6f-7167-97ef-cc6e-b01242981026 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E170:CC1A4:2BED456:37DEFB2:6B01AED0 |
| html-safe-nonce | 66b6db5dc914b0289b3da60ff0df57e37e8bf28aa1003c0cfce421ce2dbf4fb3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMTcwOkNDMUE0OjJCRUQ0NTY6MzdERUZCMjo2QjAxQUVEMCIsInZpc2l0b3JfaWQiOiIxNzYyODI5NTQ0MTU2NDA5NTUyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 404eb06df493cb7a9cbbe720d5281e03f341ca633d1bc7c37be25cc352fc4b36 |
| hovercard-subject-tag | repository:172953845 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/coder/code-server/issues/3410 |
| twitter:image | https://opengraph.githubassets.com/27fa8ee568632485558400a5c19c19893908d2c1e77b13531fcd0265be094290/coder/code-server |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/27fa8ee568632485558400a5c19c19893908d2c1e77b13531fcd0265be094290/coder/code-server |
| og:image:alt | VS Code in the browser. Contribute to coder/code-server development by creating an account on GitHub. |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-cache |
| go-import | github.com/coder/code-server git https://github.com/coder/code-server.git |
| octolytics-dimension-user_id | 95932066 |
| octolytics-dimension-user_login | coder |
| octolytics-dimension-repository_id | 172953845 |
| octolytics-dimension-repository_nwo | coder/code-server |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 172953845 |
| octolytics-dimension-repository_network_root_nwo | coder/code-server |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width