W
W
WebforSelf2021-07-21 12:35:33
WordPress
WebforSelf, 2021-07-21 12:35:33

Run script on wp a few seconds after site loads?

How to connect the js file correctly so that it connects, for example, 5 seconds after the site is loaded on WP through function?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
garmon85, 2021-07-21
@garmon85

setTimeout(function() {
s = document.createElement('script');
s.src = 'https://moclients.com/js/114181.js'; 
s.async = true;
document.body.appendChild(s);

 }, 5000);

A
Alex, 2021-07-21
@Kozack

Connect the script immediately. And in the script itself, add a timer so that it does what it needs not immediately, but after 5 seconds

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question