SSL Certificate - Recover the server's certificate (fingerprints)

Hello,
I would like to know how I can get the certificate’s fingerprints (SHA1 and SHA256) of a server given an URL entered by a user.

I don’t believe this is possible at all in a browser JavaScript environment. The TLS handshake happens at a level below that which JavaScript can see.

Thank you for your answer.
However, I do believe it can be done: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/How_to_check_the_secruity_state_of_an_XMLHTTPRequest_over_SSL.
The SSL certificate details can be found in xhr.channel.securityInfo where xhr = new XMLHTTPRequest.
Unfortunately in Ionic, xhr has no channel attribute.

I would expect that is because of:

  1. This code requires elevated privileges to run; you can only call it from a browser extension or from a XULRunner application.

Ok so in that case is it possible to make the Ionic app communicate with a web browser in order to get the certificate’s fingerprints ?
What if I created a cordova plugin ?