Flash, Javascript, an iFrame and a little imagination make for cheap and easy desktop fun.
You know those good ideas you have but put off trying, saying "I'll get to that later"? Well, Windows has long allowed an HTML file to be used as a desktop background and I've been hoping to experiment with this for a few years now. I finally got around to trying it out yesterday and can say that thanks to that thing of beauty we call the "iFrame", I was able to embed any site I cared to, including Flash apps, as my Windows background. It worked so well that I pushed the idea a little further and made a Javascript-driven HTML page that anyone can download and easily use to experiment with this little-known trick.
How It Works
The trick to it all is pretty low-tech and leverages Javascript, a cookie (to save user preferences) and an iFrame. When the HTML page is done loading, I call a Javascript function that injects an iFrame into an empty DIV that fills the screen.
The resulting (run-time) HTML looks a little like this:
[code]<div id="myFrame"><iframe name="dynDesktopFrame" src="http://www.fwaphoto.com"width="100%" height="100%" frameborder="0"></iframe></div>[/code]
The iFrame and CSS style code embedded in the document do the rest: your screen is filled with the page found at whatever URL is set into the iFrame's "src" attribute. This URL isn't hard-coded, but it set using a configurable cookie, so you can dynamically change your Windows wallpaper at will.
How To Set It Up

Keep in mind that I'm still running Windows XP so my instructions reflect that fact. I'm betting that the process is pretty much equivalent for other, slightly less ancient Windows OSes.
My apologies to Macintosh users. If you'd like to use this file, you'll have to install a 3rd party tool to allow your static image wallpaper to be replaced by a web page. Check here and here for (free) examples. I'm afraid I can't afford a Mac, so I can't test them out for you. That said, I heartily welcome your input if you try.
Step 1
Download this HTML document. (Right click the link and select "Save Link As"/"Save Target As" or equivalent.) Put the HTML file in a safe place. I put mine in my "Windows" directory.
Step 2
Pop open your Windows Display settings, go to the "Desktop" tab, click "Browse..." and select the HTML file. Click "Apply". The webpage will load in a few seconds.
Step 3
The default URL used by the page is FWA's (aka the "Favourite Website Awards") "One Photo a Day" page. I chose this because is it Flash-driven and makes for a good background but the whole point is to use the Flash app or web page of your choice as content. Just mouse-over the bottom of the screen to bring up the menu, set the URL to use and click the "Save" button. (This stores your preference in a local cookie, so no server-side code is required.)
The image below shows what the menu looks like. I think it's self-explanatory. I've even included a button to allow users to easily visit my blog. Just click it to visit me and click again to return to your selected website. (You'll have to forgive me a little self-promotion.)
To keep from interfering with your access to the desktop, 5% of its height will be left free.
It's Not (Just) All Fun and Games
While I've had fun playing with this, I think that the same principle can also be used for more serious purposes. For instance, say you want to keep your employees informed of up-to-the-minute news critical to their work. You could develop a lightweight, Flash or web-based corporate widget that feeds dynamic content to your users and embed it in their desktop backgrounds. Since Flash supports audio, this widget can set off a chime when new content comes in or something important has occurred. Furthermore, by using one or more cookies, you have nearly unbounded possibilities for user personalization without requiring server-side infrastructure to maintain the application's state.
A similar means of achieving this kind of functionality would be to wrap your Flash app in a Google Desktop widget. This is a perfectly legitimate solution and offers its own benefits, however of the two options, only the desktop background trick allows you to display an arbitrary webpage or web application as-is.
The Bad, Not The Ugly
Obviously, nothing in this life is free, and I was a little concerned that this would prove taxing on my laptop's limited CPU cycles and memory, so I did a little experimenting and found that when the page is loaded (i.e. going from no Windows background to the HTML page), the memory footprint for the "Explorer" process gains about 30MB, or roughly the cost of an instance of Internet Explorer. If you find can't live with that, I completely understand.
For some unknown reason, I'm unable to drag and drop items on my desktop into folders that are also sitting on my desktop (e.g. into the Recycling Bin). I thought I'd mention it, even though this is the case whether or not I have a background set. It therefore doesn't appear to be related to the changes I've made to my desktop settings.
Now It's Your Turn
That's it for me. If you own or know of a site, Flash-based or otherwise, that you think people would like to try as an OS background, please leave a note in the comments. Also, if you've tried this on a Mac and would like to share your experience, please fill me in.
Thank for reading and enjoy!
Leave a comment