https页面中不能使用http请求,http页面中可使用https请求。php
关于在https 页面有一些http的请求,能够在<head></head>中设置ajax
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
来自动升级http到https,就不须要修改源代码了。浏览器
若是有些浏览器不支持,能够设置jsp
phpui
header("Content-Security-Policy: upgrade-insecure-requests");
jspspa
如jsp页面<head></head>标签中能够这样设置code
<%response.setHeader("Content-Security-Policy","upgrade-insecure-requests");%>
注意:只针对静态资源 如<script src=""> ,<img src="">, <link href="" rel="stylesheet"> , <iframe src=""></iframe> , ajax请求 ,等blog
对于<a href=""> <script> window.location.href=""</script>不起做用ip
https页面能够直接跳转到 http页面。资源
若是一个https页面中包含一个iframe,则此iframe的src不能为http地址
若是一个 https页面加载的一个iframe 页面中,包含一个http超连接,则此超连接必须加上 target="_blank",此时会在新的页面打开。若是target="_self"则不会跳转。
可使用(1)中代码自动升级http到https