search

Home  >  Q&A  >  body text

javascript - Sending ajax request in https but http is blocked by the browser

I uploaded the code to github and its protocol is https, but there is an ajax request for http in my page, which is blocked by the browser. The request is an interface provided by others, and I do not have the permission to modify it. Anything, what to do?

曾经蜡笔没有小新曾经蜡笔没有小新2747 days ago639

reply all(2)I'll reply

  • phpcn_u1582

    phpcn_u15822017-05-19 10:12:50

    Sending http requests from https is not allowed unless the other party provides an https interface.

    • http://stackoverflow.com/ques...

    • http://stackoverflow.com/ques...

    reply
    0
  • 迷茫

    迷茫2017-05-19 10:12:50

    Due to Chrome security restrictions, non-authenticated certificates are treated as unsafe. So you need to add startup parameters --ignore-certificate-errors to Chrome to skip the security check. This is very simple under win, just right-click -> Properties and add after the shortcut, but it is a little troublesome under mac.

    cd /Applications/Google Chrome.app/Contents/MacOS/    # 进入Chrome.app目录
    sudo mv Google\ Chrome Google.real    # 备份/重命名原启动脚本
    sudo printf '#!/bin/bash\ncd "/Applications/Google Chrome.app/Contents/MacOS"\n"/Applications/Google Chrome.app/Contents/MacOS/Google.real" --ignore-certificate-errors "$@"\n' > Google\ Chrome    # 使用管道操作创建新的启动脚本,加入所需启动参数
    sudo chmod u+x Google\ Chrome    # 给新的脚本增加运行权限。

    Restart Chrome at this time, you can already bypass the security check and support access to addresses under the current unofficial certificate.

    reply
    0
  • Cancelreply