0

I need to refresh the content of my site at specific time (hour:min:sec), but I don't want user to know when it will be refreshed.

I don't want to refresh the page every 30 seconds. I want to reload the content only on a specific date, including seconds, and don't let the user to know this date.

What options do I have?

Luke Girvin
  • 13,221
  • 9
  • 64
  • 84
Ijuhash
  • 137
  • 13

2 Answers2

1

Please use node.js or any server side push model.I guess This could your purpose. Also check AJAX PUSH MODEL(REVERSE AJAX)

Deepak Ingole
  • 14,912
  • 10
  • 47
  • 79
0
var ld=self.setInterval(function(){window.location.reload();},60000);

The above variable refresh page every minute, and from there you can reset the refresh page in case some user press a button and you want to stop refreshing page until the user finished.

Stop refreshing:

ld=window.clearInterval(ld);
no name
  • 7
  • 7
  • I think you didn't understant what I need. I need the page reload for example on 5/8/2013 at 12:00:14. But I don't want the user to access to this date. – Ijuhash Jul 31 '13 at 09:22
  • My apologies for misunderstanding, you could create a cron job to run a specific script on your set date to refresh the page. Here is a useful link how to setup a cron job [Cron job](http://stackoverflow.com/questions/5398014/cron-crontab-execute-a-script-every-minute-and-another-one-every-24-hours) – no name Jul 31 '13 at 09:44
  • but with cronjobs is not possible to refresh the browser, is it? – Ijuhash Jul 31 '13 at 09:55
  • Mainly with a cron job you can make it do anything you want, almost. As an example, you create yourself a file name refresh.php and inside you say to grab the entire website and refresh it. Then you go to Cron and you point cron to run your refresh.php every day at 10:00. Why would you like to refresh the entire website? – no name Jul 31 '13 at 09:58
  • what I want to do is, if user is visiting the site at the specific time, he would see how browser refresh de content of the page automatically. I don't want to update internal information, only the content of a div for example. – Ijuhash Jul 31 '13 at 10:06
  • Then why dont you use jQuery/Ajax to update just that specific div anytime the user hover that div or the cursor is in page ? – no name Jul 31 '13 at 10:33
  • I want the refresh only at especific date, and user can't know it. With jquery you must tell browser the date right? – Ijuhash Jul 31 '13 at 10:48
  • You dont have to show the user when it refresh, in code you can set any date you want, and when the set date is equal with the current date, the page will automatic refresh. without telling the user anything – no name Jul 31 '13 at 10:54
  • I mean that user can see the webpage html code and see there the date. – Ijuhash Jul 31 '13 at 11:35
  • Depending on the language you use, you can send just a true/false from the backend and depending on the answer on the frontend will be refreshing or not. It's up to you. Also, you dont have to worry that people can see your source code for JS, it is normal . – no name Jul 31 '13 at 12:35