# Embedding a book from Google Books

**URL:** https://meta.discourse.org/t/embedding-a-book-from-google-books/62264
**Category:** Support
**Created:** [7 במאי,‏ 2017,‏ 7:56pm UTC](https://meta.discourse.org/t/embedding-a-book-from-google-books/62264 "2017-05-07T19:56:49Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [7 במאי,‏ 2017,‏ 7:56pm UTC](https://meta.discourse.org/t/embedding-a-book-from-google-books/62264/1 "2017-05-07T19:56:49Z")

</div>

What’s the best practice for embedding an book preview from [Google Books](http://books.google.com)?

Google books provides both a plain link and an iframe, but neither of them work out of the box:

 ![](https://global.discourse-cdn.com/meta/original/3X/6/1/61c921e4d74c038122529ae9d6936fbd964cb4e7.png)

By “don’t work” I mean they don’t give me a onebox when pasted into discourse.

The only solution I see at the moment is to whitelist [google.books.com](http://google.books.com) using @simon’s [whitelist-iframe plugin](https://meta.discourse.org/t/supporting-iframe-embeds-from-different-domains/30930/2). Is this the best/only way forward?

---

<div class="post-metadata">

### Author: ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)
#### Post date: [8 במאי,‏ 2017,‏ 9:10am UTC](https://meta.discourse.org/t/embedding-a-book-from-google-books/62264/2 "2017-05-08T09:10:46Z")

</div>

Take a look here [https://discussbook.com/](https://discussbook.com/) and here `view-source:https://discussbook.com/assets/plugin-third-party-6ae2c6dcefb0b7bf8b18b7b7f6c91a8882c9cde5f35e429cf3c2cb85fe77e855.js` .

I think that site add a js script and a `script src` to include the API library [Developer's Guide &nbsp;|&nbsp; Google Books APIs &nbsp;|&nbsp; Google for Developers](https://developers.google.com/books/docs/viewer/developers_guide)

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [8 במאי,‏ 2017,‏ 9:41am UTC](https://meta.discourse.org/t/embedding-a-book-from-google-books/62264/3 "2017-05-08T09:41:45Z")

</div>

That books integration looks fascinating (though the previews don’t seem to work, I just get an empty lightbox). What I had in mind was oneboxing the preview, but this might also work (when it works), maybe even better.

I will have to look into that source code later to see what in those 1383 lines is relevant here (I am not a programmer).

> [@Trash](#):
>
> I think that site add a js script and a script src to include the API library

Are you saying that the whole integration is done only via JS, no discourse plugin?

---

<div class="post-metadata">

### Author: ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)
#### Post date: [8 במאי,‏ 2017,‏ 9:51am UTC](https://meta.discourse.org/t/embedding-a-book-from-google-books/62264/4 "2017-05-08T09:51:18Z")

</div>

I’m not sure, but you can ask to @net_deamon (see [Discussbook on discourse, anybody interested? Not paid, but collaboration](https://meta.discourse.org/t/discussbook-on-discourse-anybody-interested-not-paid-but-collaboration/58876)).

If he wrote a plugin you can ask him to share it

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [27 במאי,‏ 2017,‏ 10:12am UTC](https://meta.discourse.org/t/embedding-a-book-from-google-books/62264/5 "2017-05-27T10:12:45Z")

</div>

> [@tophee](#):
>
> The only solution I see at the moment is to whitelist [google.books.com](http://google.books.com) using @Simon\_Cossar’s whitelist-iframe plugin. Is this the best/only way forward?

I have successfully added google books to the iframe whitelist using the whitelist-iframe plugin. 🎉 and it works just perfectly when pasting the iframe code that google books provides by default.

---

<div class="post-metadata">

### Author: ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)
#### Post date: [22 באוגוסט,‏ 2017,‏ 9:06pm UTC](https://meta.discourse.org/t/embedding-a-book-from-google-books/62264/6 "2017-08-22T21:06:51Z")

</div>

A plugin has been released today:

> [@Discourse Googlebooks](https://meta.discourse.org/t/discourse-googlebooks-plugin-for-integration-of-google-books-with-discourse/68560):
>
> [discourse-googlebooks](https://github.com/netdeamon/discourse-googlebooks) is a plugin for integrating google books with discourse. This plugin has been built to specific needs of site I run ie [https://discussbook.com](https://discussbook.com). Nevertheless, I feel that this plugin can be useful for people integrating google books with their site. Here are some screenshots from the plugin Screenshots from the plugin 1. Editor integration 2. Category Settings 3. Topic integration. Link to this [post](https://discussbook.com/t/why-are-there-so-many-links-in-the-book/243) slight_smile

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [22 באוגוסט,‏ 2017,‏ 11:40pm UTC](https://meta.discourse.org/t/embedding-a-book-from-google-books/62264/7 "2017-08-22T23:40:51Z")

</div>

> [@Trash](#):
>
> A plugin has been released today

I know, I ordered some customizations for it 😜

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2 בספטמבר,‏ 2019,‏ 3:52am UTC](https://meta.discourse.org/t/embedding-a-book-from-google-books/62264/8 "2019-09-02T03:52:45Z")

</div>



---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [27 במרץ,‏ 2023,‏ 8:47am UTC](https://meta.discourse.org/t/embedding-a-book-from-google-books/62264/9 "2023-03-27T08:47:08Z")

</div>



---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [27 במרץ,‏ 2023,‏ 10:52am UTC](https://meta.discourse.org/t/embedding-a-book-from-google-books/62264/10 "2023-03-27T10:52:13Z")

</div>


