Sample code for 30+ languages & platforms
JavaScript

Example: Http.GetServerCert method

Demonstrates how to call the GetServerCert method.
Note
This example is intended for running within a Chilkat.Js embedded JavaScript engine. All Chilkat JavaScript examples require Chilkat v11.4.0 or greater.
JavaScript
var success = false;

var http = new CkHttp();
var cert = new CkCert();

success = http.GetServerCert("chilkatsoft.com",443,cert);
if (success == false) {
    console.log(http.LastErrorText);
    return;
}

console.log(cert.SubjectDN);
console.log(cert.ValidToStr);

// Output:

// CN=*.chilkatsoft.com
// Wed, 10 Jun 2026 23:59:59 GMT