locked
using google books api RRS feed

  • Question

  • User1570641812 posted

    I have successfully used the below code to embed a google book preview into my website.

    <script type='text/javascript' src='http://books.google.com/books/previewlib.js'></script>
    <script type='text/javascript'>
    GBS_setViewerOptions({'showLinkChrome': false });
    GBS_insertEmbeddedViewer('ISBN:" + isbn13 +  "',630,675);   
    </script>

    I needed to remove the bottom bar that provided other site's prices.

    I now have to also check if the item is returned when passing the isbn. The sample code provided looks like the below.

    <script type="text/javascript" src="http://www.google.com/jsapi"></script>
      <script type="text/javascript">
        google.load("books", "0");
       
        function alertNotFound() {
          alert("could not embed the book!");
        }

        function initialize() {
          var viewer = new google.books.DefaultViewer(document.getElementById('viewerCanvas'));
          viewer.load('ISBN:isbn13', alertNotFound);
          
        }
       
        google.setOnLoadCallback(initialize);
      </script>

    I need to figure out how to either add the validation to the script I am currently using or to add the optional { 'showLinkChrome': false } to the later script. I have tried adding this optional parameter to the DefaultViewer but this doesn't work.

    Has anyone successfully implemented both of these. The documentation for optional parameters on google is pretty useless and the support forum doesn't provide any information either.

    Thanks

    Royal

    Tuesday, April 27, 2010 5:20 PM

Answers