impossible. you can only know if the response is using https. What is the use case for this? I can't think of a reason. Use other tools, very easy, but not in JS. Java you use javax.net.ssl. HttpsURLConnection, and getServerCertificates(). Very simple. Maybe I misunderstood? You just want to get connected via https? That is possible and easy. What do you mean by "接受一个server的 SSL certificate", if you want to access the certificate detail, impossible in JS.
【在 x****d 的大作中提到】 : impossible. you can only know if the response is using https. : What is the use case for this? I can't think of a reason. : Use other tools, very easy, but not in JS. Java you use javax.net.ssl. : HttpsURLConnection, and getServerCertificates(). Very simple. : Maybe I misunderstood? You just want to get connected via https? That is : possible and easy. What do you mean by "接受一个server的 SSL certificate", : if you want to access the certificate detail, impossible in JS.
One more thing, you are hitting a wall if at some point the server challenge the client, you can't do it with ajax anyway. What kind of client information you need to protect?
still better using android/ios native code the same as browser macro. you have to redo some code if you have to redo it. It is not worth to play JS this way, unless you are thinking some XSS thing. Be careful!!!!