What is the point of hiding a webpage until load?
I have noticed that whenever I go to namecheap.com, the page loads abnormally. Instead of the gradual loading like most websites, namecheap stays completely blank for a few seconds, and then suddenly everything appears. I got curious, and I looked at the page source and found this script:
(function(a,s,y,n,c,h,i,d,e){s.className+=' '+y;h.start=1*new Date;
h.end=i=function(){s.className=s.className.replace(RegExp(' ?'+y),'')};
(a[n]=a[n]||[]).hide=h;setTimeout(function(){i();h.end=null},c);h.timeout=c;
})(window,document.documentElement,'async-hide','dataLayer',4000,
{'GTM-544JFM':true});
Which goes through all the elements in the page, and removes the async-hide
CSS class from them. There is also a CSS rule: .async-hide { opacity: 0 !important}
that hides elements with this class.
To me, this seems very bad from a UX stance, but I am wondering if there is any good reason to do this?