首页 > 其他分享 >26、electron 跨域报:has been blocked by CORS policy: The request client is not a secure context and the

26、electron 跨域报:has been blocked by CORS policy: The request client is not a secure context and the

时间:2023-01-11 17:35:33浏览次数:41  
标签:26 secure private electron CORS webPreferences 跨域

在electron里面运行的页面,异常请求的时候,发生跨域问题。在普通浏览器上正常运行。解决办法:

在webPreferences上添加webSecurity: false

webPreferences:{
            webSecurity: false
        },

 

同时在文件的最顶端添加:

app.commandLine.appendSwitch('disable-web-security');

 

标签:26,secure,private,electron,CORS,webPreferences,跨域
From: https://www.cnblogs.com/handsomeziff/p/17044449.html

相关文章

  • Kubernetes 1.26.0 集群部署Prometheus监控
    前言该存储库收集Kubernetes清单、Grafana仪表板和Prometheus规则,结合文档和脚本,使用Prometheus Operator提供易于操作的端到端Kubernetes集群监控。这个项目的内......
  • ajax通过jsonp解决跨域问题
    直接上代码:前端:<scriptsrc="./jquery-1.11.2.min.js"></script><script>$(function(){$('#btn').click(function(){varurl="http:......
  • DVWA靶场实战(六)——Insecure CAPTCHA
    DVWA靶场实战(六)六、InsecureCAPTCHA:1.漏洞原理:InsecureCAPTCHA(不安全的验证码),CAPTCHA全程为CompletelyAutomatedPublicTuringTesttoTellComputersandHuma......
  • abc262 E - Red and Blue Graph
    题意:对给定无向图进行红蓝2染色,要求红点恰有\(k\)个,且两端点异色的边有偶数条。问染色方案数无重边无自环\(n\le2e5\)思路:考虑dp->复杂度不行。考虑组合数->......
  • 自签发SSL证书-解决本地开发跨域调试问题
    问题:解决问题:第一步:新建文件ext.ini,或者ext.ext都可以,写入以下内容basicConstraints=CA:FALSEkeyUsage=nonRepudiation,digitalSignature,keyEnciphermen......
  • DRF解决跨域问题
    DjangoRestFramework提供了corsheaders模块解决跨域问题安装模块pip3.9installdjango-cors-headers注册应用#注册corsheaders模块INSTALLED_APPS=[......
  • RTMP、X264与交叉编译
    RTMP、X264与交叉编译​ 与HTTP(超文本传输协议)同样是一个基于TCP的RealTimeMessagingProtocol(实时消息传输协议)。由AdobeSystems公司为Flash播放器和服务器之间音频......
  • SQL226 将employees表的所有员工的last_name和first_name拼接起来
    SQL226将employees表的所有员工的last_name和first_name拼接起来题目描述现有员工表employees请将employees表的所有员工的last_name和first_name拼接起来作为Name,中间......
  • spring boot 设置跨域访问(2)
    1.CorsConfig.javapackagecom.example.demo.config;importorg.springframework.context.annotation.Bean;importorg.springframework.context.annotation.Config......
  • abc267 F - Exactly K Steps
    题意:给定一棵树,每次询问\(u\k\),回答任意一个到\(u\)的距离距离为\(k\)的点\(n\le2e5,p\le2e5\)思路:想了很久换根dp+倍增没想出来,对树的直径太不熟悉了性质......