Check for future-posted articles via JavaScript

Aug 05, '08 07:30:00AM

Contributed by: Nobody Special

Many news sites post the next day's contributor columns several hours before providing a link on the website. Since these typically use a standard, date-based URL, I've created JavaScript bookmarks that automatically update to check if tomorrow's column has been posted.

For example, the following bookmark will check to see if David Pogue's latest State of the Art column has been posted. (Since his feature runs every Thursday, the bookmark will pull up his next column when it's posted on Wednesday afternoon/evening). The standard URL format for his column is:

http://www.nytimes.com/YEAR/MONTH/DAY/technology/personaltech/DAYpogue.html
So my JavaScript bookmark looks like this:
javascript:d=new Date();window.open("http://www.nytimes.com/"+d.getFullYear()+"/0"+(d.getMonth()+1)+"/"+(d.getDate()+1)+"/technology/personaltech/"+(d.getDate()+1)+"pogue.html", "_self");
Create a new bookmark, give it a name (Latest State of the Art) and enter the above code for the URL. For other sites, simply replace the year in the URL with +d.getFullYear()+, the month with +(d.getMonth()+1)+ and the day with +(d.getDate()+1)+. Make sure to wrap the other parts of the URL in quotes, as seen above.

Comments (5)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20080731084110294