I develop a custom html page with information about installed certificates on the local machine. The certificate's information I get by crypto provider api, then I filter returned certificates with some restrictions (Issuer, CommonName, etc). This is the work of my function loadCertificates
. I show results on button click. But loadCertificates
takes some seconds and I want to show preloader before loadCertificates
and hide after:
$("#select__cert-btn").click(function () {
showPreloader();
var certificates = loadCertificates(restrictions);
hidePreloader();
showCerificates(certificates);
});
Functions showPreloader
and hidePreloader
only add/remove div with gif background to the container with certificates info. But when I click on the button my page seems frozen and only after some seconds show results (without appearing my preloader). But in debug mode, before run loadCertificates
the preloader is added to html, but it's not visible.
Early I have never the same problem, but it seems like loadCertificates
block main thread, but if I'm right why showPreloader
not work correclty?
How to solve my problem?