国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

使用js連接websocket報錯VM4143:11 Refused to connect to ‘‘ because it violates the following Content Securi

這篇具有很好參考價值的文章主要介紹了使用js連接websocket報錯VM4143:11 Refused to connect to ‘‘ because it violates the following Content Securi。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

在使用js連接websocket后發(fā)現(xiàn)始終報錯

var ws = new WebSocket("ws://localhost:8080"); 
ws.onopen = function(){
   console.log("open");
}
ws.onmessage = function(e){
  console.log(e.data);
}
ws.onclose = function(e){
  console.log("close");
}
ws.onerror = function(e){
  console.log(error);
}

控制臺錯誤輸出

Refused to connect to 'ws://127.0.0.1:9394/ws' because it violates the following Content Security Policy directive: "default-src 'self'". Note that 'connect-src' was not explicitly set, so 'default-src' is used as a fallback.

在百度搜索無果后在一系列查略測試后發(fā)現(xiàn)在html頭中調(diào)整加入 connect-src ‘self’ ws:;文章來源地址http://www.zghlxwxcb.cn/news/detail-702874.html

  <head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; connect-src 'self' ws:;">
  </head>```

到了這里,關(guān)于使用js連接websocket報錯VM4143:11 Refused to connect to ‘‘ because it violates the following Content Securi的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔相關(guān)法律責任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • ssh連接失敗,提示ssh: connect to host port 22: Connection refused

    ssh連接失敗,提示ssh: connect to host port 22: Connection refused

    如圖,ssh連接失敗,連接顯示器輸入 sudo netstat -tuln | grep 22 命令查看占用22端口的服務(wù),無任何輸出,說明也不是默認端口22被占用的問題。 無法啟動,提示如下 查看 SSH 服務(wù)是否正在運行, 結(jié)果顯示未運行,嘗試重啟ssh服務(wù),無法啟動,提示如下 嘗試卸載openssh- server并重新

    2024年02月04日
    瀏覽(31)
  • 解決:git出現(xiàn)Failed to connect to 127.0.0.1 port 1080 Connection refused 的報錯

    解決:git出現(xiàn)Failed to connect to 127.0.0.1 port 1080 Connection refused 的報錯

    使用git將代碼push到遠程倉庫時,一直都出現(xiàn)端口代理的問題。 完成了以上兩個步驟后,還是沒有解決,但是報錯的信息發(fā)生了變化。出現(xiàn)了如下的錯誤。 ? 結(jié)果如下圖,檢查出有網(wǎng)絡(luò)問題,需要解決網(wǎng)絡(luò)問題。 一.需要在hosts文件中添加映射 1.hosts文件存在于: C:WindowsSy

    2024年02月15日
    瀏覽(18)
  • docker 部署連接nacos報錯 Connection refused: /127.0.0.1:9848

    問題描述 在搭建ruoyi系統(tǒng)時,通過docker-compose.yml啟動ruoyi-gateway、ruoyi-auth、ruoyi-modules-system報錯,不能連接nacos。 原因 項目打包的時候bootstrap.yml中默認連接的是127.0.0.1:8848。當編排到docker-compose后生成鏡像docker_ruoyi-xxx。127.0.0.1不能夠訪問nacos 解決方案 把bootstrap.yml中nacos連接全

    2024年02月11日
    瀏覽(53)
  • 【github】linux 拉代碼報錯解決:Failed to connect to github.com port 443: Connection refused

    【github】linux 拉代碼報錯解決:Failed to connect to github.com port 443: Connection refused

    有一天下午,服務(wù)器(linux)突然 github 無法 pull/push 也不能 clone 代碼了,報錯如下: 嘗試了修改代理等方法,還是無法解決,最終找到了一個解決方案: 修改/etc/hosts文件,hosts文件是Linux系統(tǒng)中一個負責IP地址與域名快速解析的文件 步驟: vi /etc/hosts 將行加入即可: 140.82

    2024年02月07日
    瀏覽(52)
  • K8s ? The connection to the server 報錯localhost:8080 was refused

    現(xiàn)象描述 K8s集群初始化成功后,kubectl get nodes 查看節(jié)點信息時報錯: 報錯信息: 解決辦法: 執(zhí)行以下命令

    2024年02月11日
    瀏覽(45)
  • 解決git報錯:fatal: unable to access ‘xxx/‘: Failed to connect to 127.0.0.1 port 7890: Connection refused

    解決git報錯:fatal: unable to access ‘xxx/‘: Failed to connect to 127.0.0.1 port 7890: Connection refused

    前言:Linux系統(tǒng),使用vscode進行遠程連接。 git push -u origin main 的時候,出現(xiàn)了如下問題: 無法連接到127.0.0.1 port 7890,連接被拒絕了。百度大法后基本上是取消代理即可: 但是我在終端中輸入命令運行后,會出現(xiàn)一個紅叉: 命令無法運行。 可能是之前設(shè)置過代理的名字不是

    2024年02月15日
    瀏覽(100)
  • Finalshell(SSH)連接虛擬機報錯java.net.ConnectException: Connection refused

    Finalshell(SSH)連接虛擬機報錯java.net.ConnectException: Connection refused

    我最初安裝的虛擬機版本是 15 Pro,天真的以為老版本更穩(wěn)定,沒想到和win10或11不兼容,裝好之后,開啟虛擬機后 電腦就藍屏重啟,然后卸載重裝官網(wǎng)的新版 17 Pro,解決。 (下載地址) 安裝CentOS7鏡像的過程: 可以看到黑屏幕最上面有兩個選項,我們可以通過 上下鍵 來選擇

    2024年02月05日
    瀏覽(20)
  • ssh連接服務(wù)器出現(xiàn):ssh: connect to host **** port 22: Connection refused 的解決方法

    ssh連接服務(wù)器出現(xiàn):ssh: connect to host **** port 22: Connection refused 的解決方法

    我是windows10 連接 windows server2019 一直出現(xiàn) ssh: connect to host **** port 22: Connection refused 查了一堆方法沒有想要的 首先去看你的虛擬機有沒有開啟遠程訪問,沒有開啟當然訪問不了。 點擊允許遠程訪問 點擊允許,然后選擇用戶添加你新增的用戶。 然后不要看本機上面的的ipv4地址

    2024年02月11日
    瀏覽(24)
  • 解決Ubuntu18.04的git clone報錯Failed to connect to github.com port 443: Connection refused

    解決Ubuntu18.04的git clone報錯Failed to connect to github.com port 443: Connection refused

    (只看解決方法的可直接拉到文末?。。。?第一次在ubuntu終端使用git clone,結(jié)果報錯?Failed to connect to github.com port 443: Connection refused,折騰了半天,終于成功下載(感謝這篇博客解救git clone 時Failed to connect to github.com port 443:connection timed out 怎么辦-CSDN博客) 先把終端操作貼下

    2024年02月06日
    瀏覽(34)
  • 【已解決】解決Finalshell連接Linux報錯java.net.ConnectException: Connection refused: connect

    【已解決】解決Finalshell連接Linux報錯java.net.ConnectException: Connection refused: connect

    ?錯誤提示:java.net.ConnectException: Connection time out: connect 解決辦法:重新啟動系統(tǒng)SSH服務(wù)? ?如linux輸入? #service sshd restart

    2024年02月14日
    瀏覽(23)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包