I am making https calls in javascript via xmlhttprequest. I know the server and its public key in advance. For extra security, I would like to check the public key (or its fingerprint) if its is what I expect.
But I want to do that before I send any data over the network and if the fingerprints do not match, I do not want to send any data. Is that possible with xmlhttprequest? I found this page, but here the the fingerprint is only retrieved after a request has already been made.