Autoplay HTML on CD for Windows & Mac

Chris J Allen picture Chris J Allen · Apr 4, 2012 · Viewed 14k times · Source

I'm building a CD for a client that contains a video training course. I am building it in HTML and JavaScript. I wish this to auto-play the index.html file on windows & Mac.

I understand Windows 7 doesn't auto-play by default, but I just want some advice on how to make this as seamless as possible. Everything I've done up until now has been on the Web, not on a CD. Thanks.

Answer

Iain Collins picture Iain Collins · Apr 4, 2012

Mac OS X (unlike classic Mac OS) doesn't support autorun style behaviour.

You can however have a volume (CD, disk image, etc) open when inserted though. Downloadable disk images typically do this, and often have custom background images.

e.g. When making an AOL CD, after making my disk image (can be an .ISO, .DMG, etc) I've done something like this after my automated build step:

$ hdiutil mount -readwrite /path/to/disk-image.ISO

$ bless --folder /Volumes/MyDisc --openfolder /Volumes/MyDisc

I then configure the window size and location and icon positions appropriately (manually).

$ /Developer/Tools/SetFile -a V "/Volumes/MyDisc/CD Background Image.png"

$ hdiutil eject /Volumes/MyDisc

The file "CD Background Image.png" being a graphic on the disk, which I use SetFile to make invisible. I think the command to do this on Mac OS X 10.7+ (if you don't have the developer tools installed) is:

chflags hidden "/Volumes/MyDisc/CD Background Image.png"

NOTE: If you mount the disk image again before burning, there is a good chance you will lose any configuration done and will need to repeat this process.

If you just have one partition on the disk (rather than one for Mac and one for Windows) then you will want to hide Windows only files like "autorun.inf", etc. too.

Going beyond that (and slightly off topic):

You may want to use something like an AppleScript to launch a browser Window of a specific size. Going beyond that, you might want to consider using something like Mozilla Prism http://prism.mozillalabs.com/ for a slick experience for HTML content deployment.