在JavaScript中检查SSL证书是否有效 [英] Check in JavaScript if an SSL Certificate is valid

查看:603
本文介绍了在JavaScript中检查SSL证书是否有效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以检查JavaScript,如果给定主机的SSL证书有效? (非阻塞)

Is there a way to check in JavaScript if given a host its SSL certificate is valid? (non blocking)

就我而言,我想显示:您也可以使用https://."如果通过JavaScript,我可以向https://my_url发出请求,而无需要求接受不受信任的证书.

In my case, I want to display: "you can also use https://.." if via JavaScript I can make a request to https://my_url without being asked to accept an untrusted certificate.

这可以异步完成吗?

推荐答案

这个问题没有道理.如果不打开服务器的SSL连接,就无法获得服务器的SSL证书,一旦完成,告诉用户他们也可以这样做就没有意义.

The question doesn't make sense. You can't get the server's SSL certificate without opening an SSL connection to it, and once you've done that, telling the user they can do that too is a bit pointless.

这篇关于在JavaScript中检查SSL证书是否有效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆