Need your help with the preloader for the site. Loader works until the page is fully loaded, but the site has a callback script from a third-party site. This script specifically increases the page loading time and content display up to 30 seconds, and without it 6 seconds. Is it possible to somehow configure the loader script so that the third-party script loads after displaying the content on the page?

<div id="loader-overflow"> <div id="loader3" class="loader-cont">Please enable JS</div> </div> $(window).load(function() { $("body").imagesLoaded(function() { $(".loader-cont").fadeOut(); $("#loader-overflow").delay(200).fadeOut(700); }); }); 
  • you can make the script initially not load at all, but only after the page has completely loaded - sergey - dev

2 answers 2

Connect this script where you have all the js - new.js. This script will contain the connection of your third-party script -

 window.onload = { document.write ('<script type="text/javascript" src="js/storonniscript.js" ></sc' + 'ript>'); } 

That is, when the download happens, this script will connect

  • the idea is excellent, but the third-party script does not connect ... ie it does not work - realegatun

That's how it worked, can anyone fit

 window.onload = function() { $.getScript("/js/storonniscript.js"); };