javascript - 安装 SSL 后某些脚本停止工作

标签 javascript jquery ssl https

我使用以下代码打印 div 元素内的内容。在我在服务器中安装 SSL 证书之前,这对我来说效果很好。如果我通过 http:// 访问页面,代码仍然有效。但是,当通过 https:// 访问同一页面时,它不起作用。我需要帮助解决这个问题。

function PrintElem(elem)
{
    Popup($(elem).html());
}

function Popup(data) 
{
    var mywindow = window.open('', 'Business Sense Chart', 'height=600,width=1200');
    mywindow.document.write('<html><head><title>Business Sense Analytics</title>'); 
    mywindow.document.write('<link rel="stylesheet" href="./css/style.css" type="text/css" />');
    mywindow.document.write('</head><body><center>');
    mywindow.document.write(data);
    mywindow.document.write('</center></body></html>');
    mywindow.print();
    return true;
}

注意:当我使用firebug诊断错误时,它显示错误“$ is not a function”。类似的其他脚本也面临同样的问题。

最佳答案

Note: When I used firebug to diagnose the bug, it showed the error "$ is not a function". Similar other scripts are facing the same problem.

您很可能是从 HTTP URL(也许是 CDN?)加载 jQuery,这会导致浏览器以不安全为由阻止它。所有 Assets - 图片、脚本、CSS 等 - 都需要在 HTTPS 页面上使用 HTTPS。

关于javascript - 安装 SSL 后某些脚本停止工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17886650/

相关文章:

javascript - bxSlider jQuery 插件问题

javascript - 如何用溢出 :auto with arrows 替换 div 的滚动条

javascript - 在函数中渲染 JSX 元素

javascript - 在 jQuery 中包装生成的元素

javascript - 我可以使用 jQuery 检查是否至少选中了一个复选框吗?

Java servlet - 用于代码安全连接的 TLS 日志版本?

javascript - 尝试使用 JS 在浏览器上安装证书时出错

apache - 如何转换configure apache2来处理https

javascript - 如何从 $ ('p' 的集合中删除所有类?

javascript - jQuery:如何检测弹出窗口是否关闭?