Friday, November 12, 2010

When embedding a Kindle Web Sample

If you have a blog where you want to embed Kindle books, here is a tip.

When you copy the HTML to place on your web page or blog post, note that div id used. It reads "kindleReaderDiv" and is later referenced by this name in the JavaScript as KindleReader.LoadSample({containerID: 'kindleReaderDiv', ....

If you have more than one post that appears on the same page with such content embedded, it is going to be bunched together in the same place rather than in their respective posts. This is because of the div id.
A simple fix is to give each such div its unique id.
If I am embedding Michael Crichton's "Pirate Latitudes", all I do is add the word "Pirate" to the end of the div id, so that the whole thing now reads as:

© 2010, Abhinav Agarwal. All rights reserved.