Google books API is cool, it gets you quite some info and it is easy to use. I used it in My Reading List ( you can read more here ) .

Book preview

Last week, apart from creating a widget, I tried to improve the code a bit for the book preview button. I programmed the book preview button to open an iframe overlay (fancybox) and tries to load the book's preview. If not found, it redirects to google's book page. 

Update

How does it work?

Below the script. After loading Google's jsapi library, google.setOnLoadCallback(previewTitle), is called. previewTitle is a function that tries to create a view of the book (googleID) you pass in (php get variable in this case). If it can't find it, alertNotFound is called which puts a message and redirects to google's book page. A wrapper div "viewerCanvas" is defined to load in the content. All this happens in the preview.php page that gets loaded in an overlay iframe upon clicking the google preview button (first printscreen)

Result:



More info

At the developers guide. Check this script out here


Bob Belderbos

Software Developer, Pythonista, Data Geek, Student of Life. About me