Popup Load Automatically

Hi, i am new here and don;t know much about Javascript. I have the following code which is written in javascript, i want to to run this code automatically after 2 or 3 seconds when my page is fully loaded in browser.
<script type="text/javascript">
var uid = '236690';
var wid = '490105';</script>
<script type="text/javascript" src="//cdn.popcash.net/pop.js">
</script>

Hi @onlineearnings112, do you have a link to the documentation for that popup script?

The code is designed to run automatically as soon as the script is loaded.
About the only way to delay its running is to add the script tag after the page has loaded.

document.body.addEventListener("load", function () {
  var script = document.createElement("script");
  script.src = "//cdn.popcash.net/pop.js";
  document.body.appendChild(script);
});

(except by default if you trigger off of the load you can setTimeout to delay the loading of the second source.)

Actually i have received this javascript code from different advertisement companies like popads, popcash, mypopads etc…
they send me this code to adjust in my website for running ads. i put this code into tag. this code is only run when i click anywhere in my page.
Now, i want that when my page fully loaded in my browser, this code(javascript) should be run automatically after 2 or 3 seconds without any click on to my page.

@Paul_Wilkins, i use this code into my HTML but its only work when i click in my browser body area. i need to run this action automatically when my page load.

The code isn’t designed to work that way. I recommend that you refer to their documentation and failing that, contact their support team.

Maybe try something like this as a workaround…

window.setTimeout(function () {
  document.body.click()
}, 2000)

… but as @Paul_Wilkins said, better check their docs / support first.

How can i merge this code into that javascript code?

yes but there is no documentation/support file they sent.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.