http和https以及跨域 发表于 2017-08-23 | 分类于 JS/JQ | httphttpshttps 会阻挡别的域名调用该连接的图片资源 跨域https://www.liaoxuefeng.com/wiki/001434446689867b27157e896e74d51a89c25cc8b43bdb3000/001434499861493e7c35be5e0864769a2c06afb4754acc6000 1234567// 转为http;var targetProtocol = "http:";// 转为https;var targetProtocol = "https:";if (window.location.protocol != targetProtocol) window.location.href = targetProtocol + window.location.href.substring(window.location.protocol.length);