lime icon

Phosphorus and Lime

A Developer's Broadsheet

This blog has been deprecated. Please visit my new blog at klenwell.com/press.
JS: reload page once
Needed to reload a page once and only once a couple seconds after someone sees it. Why? For this site. In order for someone to see their own confession displayed, the page must be reloaded after he or she has posted it. I came up with this:

// reload_once()
function reload_once()
{
var this_url = location.href;

if ( this_url.indexOf("?reloaded") == -1 )
{
// window.location.replace(this_url + "?reload")
document.write('<meta http-equiv="refresh" content="3;url=' + this_url + '?reloaded">');
}
}

reload_once();


Seems to do the trick and rather efficient. Inspired by this.