
My pages update continuously, all day long. It costs me extra server power to make it work. Why update pages in realtime? I love fresh content. Every page refresh is unique and to me that’s instant gratification. You are the 1st person to see this particular page! It’s a good feeling to be 1st.
How do I do it? Not with AJAX–that would slow the server significantly. AJAX-updated content is annoying to read, in my opinion, text scrolling by on a page. What you see right now is a snapshot in time. If you refresh this page you will see some of the content changed. However, that was not obviously apparent. Which is why I hacked together this script to count the seconds since a page loaded. Here it is:
<small style=”color:#777;”>updated <big id=”time” style=”color:crimson;”>1</big> seconds ago!</small>
<script type=”text/javascript”>
Date.ONE_SECOND = 1000;
timeIn = new Date();
onload = function () {setInterval (“document.getElementById (‘time’).firstChild.data = Math.round ((new Date ().getTime() – timeIn.getTime()) / Date.ONE_SECOND)”, 1000)}
</script>