最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Some scripts stopped working after SSL installation - Stack Overflow

programmeradmin0浏览0评论

I use the following code to print the contents inside a div element. This worked fine for me until I installed a SSL certificate in my server. The code still functions if I access the page via http://. However it is not working when the same page is accessed via https://. I need help solving this problem.

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;
}

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.

I use the following code to print the contents inside a div element. This worked fine for me until I installed a SSL certificate in my server. The code still functions if I access the page via http://. However it is not working when the same page is accessed via https://. I need help solving this problem.

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;
}

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.

Share Improve this question edited Jul 26, 2013 at 18:14 Mogsdad 45.8k21 gold badges162 silver badges285 bronze badges asked Jul 26, 2013 at 16:39 wishchaserwishchaser 6282 gold badges7 silver badges19 bronze badges 1
  • 3 Are you perhaps including the script using a http link (instead of https). Browsers block non-secure content by default. – Halcyon Commented Jul 26, 2013 at 16:40
Add a ment  | 

1 Answer 1

Reset to default 7

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.

You are most likely loading jQuery off an HTTP URL (CDN, perhaps?), which causes browsers to block it as insecure. All assets - images, scripts, CSS, etc. - need to be HTTPS on a HTTPS page.

发布评论

评论列表(0)

  1. 暂无评论