How To Call An External Script At A Specific Time/Hour
How To Call An External Script At A Specific Time/Hour
On this occasion, I will share a trick, that is the trick of calling external scripts at specific times or who have been determined. the bottom line like this if at the current time determined then the scripts on this website will call external scripts from outside of the blog, and if time is specified then this script will be automatically disabled on its own.
How to Call an External Script At a specified time
For example:We are setting as follows:
06.00-18.00 Script will live
19.00-05.00 Script will die/off
Or it could be a different script we call
06.00-18.00 Script 1
19.00-05.00 Script 2
For the following Way:
1. Upload your scripts on your hosting or free upload site like yourjavascript.com
2. If you already check email, and make a note of the URL
3. Enter this code into the widget:
<script type='text/javascript'> var now = new Date(); var hours = now.getHours(); if (hours >= 20 && hours <= 8){Replace http://yourjavascript.com/52516112701/antelops.js with the url address of your script
document.write("Selamat Malam");
}document.write("Selamat Malam"); } else if (hours >= 9 && hours <= 19){document.write("<scr"+"ipt language=javascript src=http://yourjavascript.com/52516112701/antelops.js></scr"+"ipt>");}</script>
KET:
Blue: the span of time the Script will work (24 hours)
Only Text Code:
(2 script)
Or like this:
(2 script 1 text)
{document.write("Selamat Malam"); }Kode Script yang akan dipanggil{document.write("<scr"+"ipt language=javascript src=http://yourjavascript.com/52516112701/antelops.js></scr"+"ipt>");}You could be combining this way:
(2 script)
<script type='text/javascript'> var now = new Date(); var hours = now.getHours(); if (hours >= 20 && hours <= 8){document.write("<scr"+"ipt language=javascript src=http://yourjavascript.com/52516112701/antelops1.js></scr"+"ipt>");
}} else if (hours >= 9 && hours <= 19){document.write("<scr"+"ipt language=javascript src=http://yourjavascript.com/52516112701/antelops2.js></scr"+"ipt>");}</script>
Or like this:
(2 script 1 text)
<script type='text/javascript'> var now = new Date(); var hours = now.getHours(); if (hours >= 20 && hours <= 8){document.write("<scr"+"ipt language=javascript src=http://yourjavascript.com/52516112701/antelops1.js></scr"+"ipt>");} else if (hours >= 9 && hours <= 15){document.write("<scr"+"ipt language=javascript src=http://yourjavascript.com/52516112701/antelops2.js></scr"+"ipt>");}else if (hours >= 15&& hours <= 19){document.write("Selamat Sore");}</script>
Keep in mind:
Note the order of the script above don't get wrong
Hopefully helpful
0 Response to "How To Call An External Script At A Specific Time/Hour"
Posting Komentar