May 21, 2008
If you have content on your pages that displays randomly every time a user hits the page, you might like this handy little piece of code that will make the page refresh all by itself after a specified period of time. It’s called a meta refresh and all it takes is one line of code.
Insert the following code into an iWeb HTML widget or RapidWeaver HTML page. The number of seconds to pause before refreshing is set to “60″ in the example below, but you can set it to any number you choose.
<meta http-equiv="refresh" content="60" />
Suzanne,
Thanks for this little snip of code. I didn’t know it existed and it’s perfect for a couple of pages in my website!
Hey Mathew – great to see you again. Sneaky little refresh ey? I use that on a stats page that runs in the background here, but I may also use it on my home page later when I get some better content prepared. I always thought you had to have that in the <head> section of your HTML, but you don’t – it works in the body too.
This seems really simple and neat – what are some practical applications for it? :-)
Maybe Mathew will share how he’s using it, but I’ve used that in two different situations in the past: 1) to refresh my home page and 2) to refresh a dynamic statistics window I often have running.
It’s not the case at the moment, but I have a script that will randomly display content every time a user hits a page. My old design used that script to rotate the images in my header. You might remember that. I also use that script to rotate featured products, or featured whatever. Sometimes you want the page to refresh, even though the user is still sitting there. That way the content appears new – and refreshing ;-)
It’s not something you want to do on every page, all the time. It should only be used in situations where someone will be viewing the page and just scanning everything to see what’s interesting. You don’t want to force a refresh when they’re in the middle of a 10-page article doh!
Niko: I’m a professor and Suzanne’s script is useful for course webpages I’ve developed that have comments on them. It happens often enough that some students don’t realize they need to refresh/reload a page to see their submitted comments, or to view new posted comments after they entered the page. So if I use this refresh command, then that takes care of one problem my students have: even if they don’t remember/know about reloading they’ll still see the new “stuff” that gets posted.
Suzanne: I think you mentioned that you created the CSS style for posting comments by using boxes that do not invoke images. Would you be willing to share that CSS styling with us mere mortals?
Indeed! I already have :) The article that follows this one, the rounded corner rollover button article, includes the top secret CSS that produces the rounded corners. I’ll post a comment there with the exact code.