我无法使用 JQuery 加载网页/网站,因为该网站的安全证书无效。 有没有办法使用 JQuery 强制加载具有无效安全证书的网站?
我的 FireFox 控制台出现以下错误:
www.example.com uses an invalid security certificate. The certificate is not trusted because it is self-signed. The certificate is only valid for new.example.com Error code: SEC_ERROR_UNKNOWN_ISSUER
我的测试代码是:
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("button").click(function(){
$("#div1").load("https://www.example.com");
});
});
</script>
</head>
<body>
<div id="div1"><h2>Let jQuery AJAX Change This Text</h2></div>
<button>Get External Content</button>
</body>
</html>
最佳答案
你不能。只有用户(或本地程序)可以在浏览器中添加异常。
关于jQuery 加载无效的安全证书错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37184008/