【发布时间】:2013-04-29 06:59:08
【问题描述】:
当我转到我网站的游戏部分时,按钮可以正常工作:http://sharepanel.net/games/
当我通过安全 SSL 连接访问页面时,按钮不执行任何操作:https://sharepanel.net/games/
我错过了什么吗?
这是按钮的 Javascript 代码:
<script>
function getPage(el,page){
$(el).load(page, function(response, status, xhr) {
if (status == "error") {
var msg = "Error While Loading Page: ";
$(el).html(msg + xhr.status + " - " + xhr.statusText);
}
});
}
$(function(){
$("#top10").on("click",function(){
getPage("#main","/games/top10.php");
});
$("#action").on("click",function(){
getPage("#main","action.php");
});
$("#adventure").on("click",function(){
getPage("#main","adventure.php");
});
$("#timemanage").on("click",function(){
getPage("#main","timemanage.php");
});
$("#fungames").on("click",function(){
getPage("#main","fungames.php");
});
$("#newgames").on("click",function(){
getPage("#main","newgames.php");
});
$("#randomgames").on("click",function(){
getPage("#main","randomgames.php");
});
});
</script>
【问题讨论】:
-
可能是同源策略,但它取决于
jQuery.load()。您是否尝试过使用load("//path/" + page, ...)代替? -
我的猜测是您通过 http 与 https 采购 jquery,而您的浏览器不会让您这样做。如果有的话,你的控制台输出是什么
-
我想我刚刚弄明白了原因...这是控制台输出:[已阻止]sharepanel.net/games 的页面运行了来自code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css 的不安全内容。 sharepanel.net:5 [阻止]sharepanel.net/games 的页面运行来自ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js 的不安全内容。 sharepanel.net:1 [阻止] sharepanel.net/games 的页面运行来自 code.jquery.com/ui/1.10.3/jquery-ui.js 的不安全内容。 sharepanel.net:1 Uncaught ReferenceError: $ is not defined sharepanel.net:22
标签: javascript jquery button ssl