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.
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)