A
A
Alexey Krylov2015-09-11 11:30:46
JavaScript
Alexey Krylov, 2015-09-11 11:30:46

Running a counter script after a specific time?

View counter code VKontakte

<script type="text/javascript">
(window.Image ? (new Image()) : document.createElement('img')).src = location.protocol + '//vk.com/rtrg?r=ziJaPV1O/HccuB0hK7*io3r9X*EeIXGfLA7cuTRCH*McMgO1c1xyBrLMJepfNJDhJ*fkU9nAWmHkN6cHsI*DHMGCNz3XmL2W9qubiVVoDqnlLBcMdotY-';
</script>

How to make it work not immediately after the page is loaded, but for example after 15 seconds?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vitaly Inchin ☢, 2015-09-11
@Telos

setTimeout(function(){
  //Интересно так, сначала обращаетесь к window.Image, потом просто к Image...
  (Image ? (new Image()) : document.createElement('img')).src = location.protocol + '//vk.com/rtrg?r=ziJaPV1O/HccuB0hK7*io3r9X*EeIXGfLA7cuTRCH*McMgO1c1xyBrLMJepfNJDhJ*fkU9nAWmHkN6cHsI*DHMGCNz3XmL2W9qubiVVoDqnlLBcMdotY-';
}, 15000);

G
Greg Popov, 2015-09-11
@Gregpopov

setTimeout() will solve the problem?

A
Alexey Krylov, 2015-09-11
@Telos

Maybe he will decide. I found examples of solutions with setTimeout () but for other scripts. But since I'm not strong specifically in javascript, I have no idea how to enter these conditions into this code. I looked at many examples, but I could not implement it. If possible, write a specific solution for this script. Thanks

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question