I want to create an application in PHP.
concept is very simple, I want to just auto load every page randomly at a regular intervals. For example, if I entered to facebook.com, it would be auto load randomly profile.php, notifications.php, messages.php etc… I am not sure about its practicality. So my question may be stupid, but I need help. I only know meta refresh which is only for refreshing the page.
<meta http-equiv="refresh" content="5; url=http://example.com/">
But I think, using the loop , My concept will work. But I have no idea how loop will work with meta tag.
Advertisement
Answer
I finally got the soloution,
<script>
var interval = 5; // in seconds
var pages = [
'http://website.com/link1.php',
'http://website.com/link2.php',
'http://website.com/link3.php'
];
var current_page_index = 0;
setInterval(function() {
loadintoIframe('myframe', pages[current_page_index]);
current_page_index = (current_page_index + 1) % pages.length;
}, interval * 1000); // second setInterval param is milliseconds
</script>