赞
踩
问题:前端页面调用后端接口加载不出来
原因:
控制台警告: Mixed Content: The page at https://* was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint http://*. This request has been blocked; the content must be served over HTTPS
混合内容:https://*上的页面是通过HTTPS加载的,但是请求了一个不安全的XMLHttpRequest端点http://*.此请求已被阻止;内容必须通过HTTPS提供
解决方案:
动态匹配当前域名协议,调用和域名协议一致的下载链接
let url = window.location.protocol + "//" + res.data.replace("http://", "").replace("https://", ""); window.open(url);
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。