How to Make an HTML Element on Your Website Disappear after 10 Days
October 13th, 2007After October 15th, 2007 this message will disappear forever.
The text above is an example of auto-expiring HTML. (Don’t see it? If it’s after October 15, 2007, then it’s working
Perhaps try viewing the source of this page to see it.)
Do you have any of these problems? If so then auto-expiring HTML may help you:
- You put a “new” images around new content on your website, but then forget to ever remove them thus embarrassing yourself and your community.
- You put a deadline for your project on a website, but if you miss the deadline, wouldn’t it be nice if the deadline conveniently disapeared from the page automatically?
- Your brilliant blog post made it to the front page of Reddit. You want to put a message welcoming them, but since they’ll only be around for a day, you want the message to disappear automatically by the next day.
(All these examples assume you’re lazy, and care more about convenience than bandwidth.)
Can you think of more uses for auto-expiring HTML? Please leave a comment.
How to Make Auto-Expiring HTML
I’ve made this handy utility to automatically create auto-expiring HTML for you. You enter the content you want to expire, set the number of days to expiry, and paste the output into your webpage. Check it out.
How it Works
The utility wraps a div tag around whatever HTML you enter, and puts some javascript under it to hide that div if the current date is greater than your set expiration. There’s more information about its workings in the utility’s writeup.








