This mashup was just obvious. You've probably seen these snap.com website previews that hover over links on TechCrunch and various other sites. Can be useful and can be, well, a bit annoying, depending on the site in question. For Weborandom, though, there was no question. It just made eternal sense and I kept imagining it was there, so it was high time I added it in. Admittedly, Weborandom already provides a preview, so this is a kind of preview for a preview. Works for me anyway. With thanks to snap.com for providing their easy-to-integrate API, it's now live.
Go visit the new, new, Snapshots (TM)-enabled, Weborandom.com!!!
The main challenge was to make the previews refresh dynamically, which was achieved with a little On-Demand Javascript magic:
- function refreshSnapshots() {
- var head = document.getElementsByTagName("head")[0];
- var script = $("snapshotScript");
- if (script) { head.removeChild(script); }
- script = document.createElement("script");
- script.id = 'snapshotScript';
- script.type = 'text/javascript';
- script.src = "http://shots.snap.com/snap_shots.js?ap=1&key=d2e3ec72c47f90dc1ccf4c25de818ed2&sb=0&th=silver&cl=0&si=0&po=0&df=0&oi=0&link_icon=on&shots_trigger=icon&size=large&lang=en-us&domain=weborandom.com";
- head.appendChild(script)
- }
I daresay the next installment will be the big one: search. It was originally intended to do that, but mysql fulltext queries crawl with several million records. I'll need to experiment with ferret and friends.


2 responses so far ↓
1 Great Sky // May 5, 2007 at 7:22 am
Hello, Web-O-Random looks cool. Where did you get the idea?
2 mahemoff // May 7, 2007 at 11:41 am
Believe it or not, it stemmed from thinking it of the name. Sometimes websites happen like that. Once I decided to do a random web page website, it was clear Ajax would be involved, so …
Leave a Comment