php - 混合内容警告;Favicon 被阻止和罪魁祸首,但我没有指定它
问题描述
我有一个带有一些 jQuery ajax 和 PHP 后端的简单网页,可以轻松error_log
快速查看并删除它以进行调试和开发。
但是,我在 FireFox 中注意到我有一个混合内容警告。我检查了Chrome,它给出了错误。
混合内容:“https://website/error_log.php”页面通过 HTTPS 加载,但请求了不安全的网站图标“http://website/content.php?error=404”。此请求已被阻止;内容必须通过 HTTPS 提供。
这对我来说很简单,因为我只需要找到 Favicon 并使用 https 指定正确的路径(因为它显然没有找到并将其扔到 404 页面)。但是,我的页面上根本没有指定网站图标,为什么它会给我混合内容通知?
错误日志
<?php
if(@$_GET["unlink"]=="yes") {
if(file_exists('error_log')) {
unlink('error_log');
}
exit(0);
}
if(@$_GET["ajax"]=="yes") {
if(file_exists('error_log')) {
//$file = file_get_contents('error_log');
$fileLines = file('error_log');
// Swap the order of the array
$invertedLines = array_reverse($fileLines);
echo '<pre>';
//echo $file;
for($i=0;$i<count($invertedLines);$i++) {
echo $invertedLines[$i];
}
echo '</pre>';
}
else {
echo '<pre>';
echo '<div align="center">The error log is currently empty.</div>';
echo '</pre>';
}
exit(0);
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Error Log</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
$(document).ready(function() {
var interval;
interval = setInterval(counter, 1000);
$("#refresh").click(function(){
refreshlog();
clearInterval(interval);
$('#refresh').val("Refreshed...");
interval = setInterval(counter, 1000);
});
$("#delete").click(function(){
unlink();
});
var count = 30;
function counter() {
if(count===30) {
refreshlog();
}
count--;
//console.log(count);
$('#refresh').val('Refresh Error Log ('+count+')');
if (count === 0) {
count = 30;
}
}
function refreshlog() {
$.ajax({url: "./error_log.php?ajax=yes", success: function(result){
$("#div1").html(result);
}});
}
function unlink() {
$.ajax({url: "./error_log.php?unlink=yes", success: function(result){
refreshlog();
}});
}
});
</script>
<style>
pre
{
font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
margin-bottom: 10px;
overflow: auto;
width: auto;
padding: 5px;
background-color: #eee;
width: 650px!ie7;
padding-bottom: 20px!ie7;
max-height: 500px;
}
</style>
</head>
<body>
<div align="center"><input type="button" id='refresh' style="border: 1px solid #050; color: #050; padding: 5px; margin: 3px; cursor: pointer;" value="Refresh Error Log"><input type="button"id='delete' style="border: 1px solid #C00; color: #c00; padding: 5px; margin: 3px; cursor: pointer;" value="Clear Error Log"></div>
<hr>
<div id='div1'></div>
<hr>
</body></html>
解决方案
推荐阅读
- c# - HttpWebRequest 很慢
- javascript - 如何更改 jQuery Skitter.js 幻灯片的宽度?
- javascript - 如何将数据从对话框传回angularjs中的控制器?
- javascript - 如何在反应原生中调整 webview 中的一些 javascript?
- php - 将 PHP 5.6 升级到 7.1 时 PHP PDO ODBC 扩展出现问题
- spring - 如何回滚一种方法并在测试中提交第二种方法
- python - 在递归函数中附加一个带有列表的空列表
- c# - wpf根据孩子缩放画布宽度
- python - PyQt 上一个 GUI 框架的“后退”按钮的适当功能
- c# - 尝试在 Visual Studio 2015 中构建使用 Visual Studio 2017 构建的 Web 应用程序时出错