# Google docs onebox gem requires a "published" document

**URL:** https://meta.discourse.org/t/google-docs-onebox-gem-requires-a-published-document/33649
**Category:** Support
**Created:** [September 23, 2015, 4:42pm UTC](https://meta.discourse.org/t/google-docs-onebox-gem-requires-a-published-document/33649 "2015-09-23T16:42:23Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![downey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/downey/32/166878_2.png) [@downey](https://meta.discourse.org/u/downey)
#### Post date: [September 23, 2015, 4:42pm UTC](https://meta.discourse.org/t/google-docs-onebox-gem-requires-a-published-document/33649/1 "2015-09-23T16:42:23Z")

</div>

Embedding a Google document via the onebox gem seems to be broken. All that displays is a blank placeholder. When trying new posts, I get the following error in the console:

> Load denied by X-Frame-Options: (Google Doc URL) does not permit cross-origin framing.

I’ll paste the URL of a sample document, [https://docs.google.com/document/d/1IQGdx-1X-E\_W3O5PSiV9RF1hhjI5hryWZF9FFYNv4Oc/edit?usp=sharing](https://docs.google.com/document/d/1IQGdx-1X-E_W3O5PSiV9RF1hhjI5hryWZF9FFYNv4Oc/edit?usp=sharing), in a line by itself here:

[https://docs.google.com/document/d/1IQGdx-1X-E\_W3O5PSiV9RF1hhjI5hryWZF9FFYNv4Oc/edit?usp=sharing](https://docs.google.com/document/d/1IQGdx-1X-E_W3O5PSiV9RF1hhjI5hryWZF9FFYNv4Oc/edit?usp=sharing)

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [September 23, 2015, 5:48pm UTC](https://meta.discourse.org/t/google-docs-onebox-gem-requires-a-published-document/33649/2 "2015-09-23T17:48:55Z")

</div>

Added on my list. ✏

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [September 25, 2015, 7:06am UTC](https://meta.discourse.org/t/google-docs-onebox-gem-requires-a-published-document/33649/3 "2015-09-25T07:06:14Z")

</div>

Michael, are you sure you [published](https://support.google.com/docs/answer/37579?hl=en) the Google Doc you are trying to onebox?

Google Doc needs to be published (_not shared_) for embedding. [More info here](https://support.google.com/docs/answer/143345).

In my testing the published Google Doc is getting embedded.

* * *

> **[Discourse Onebox](https://docs.google.com/document/d/1ly-k_ElI36dYDnPxFzWkBvMuzV1ALetVNjekTBsfd_Q/edit?21)**
>
> Discourse Onebox Embed testing!

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [September 25, 2015, 7:23am UTC](https://meta.discourse.org/t/google-docs-onebox-gem-requires-a-published-document/33649/4 "2015-09-25T07:23:20Z")

</div>

Can we convert the URLs into the publish form automatically?

May want to build on top of [FEATURE: Add placeholder for google docs oneboxes by riking · Pull Request #307 · discourse/onebox · GitHub](https://github.com/discourse/onebox/pull/307) so we don’t get iframe flashing.

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [September 25, 2015, 7:38am UTC](https://meta.discourse.org/t/google-docs-onebox-gem-requires-a-published-document/33649/5 "2015-09-25T07:38:39Z")

</div>

> [@riking](#):
>
> Can we convert the URLs into the publish form automatically?

I don’t think so. I believe only the document owner has the rights to publish that document.

Simply appending `/pub` at the end of the URL will not allow embedding of that document.

---

<div class="post-metadata">

### Author: ![downey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/downey/32/166878_2.png) [@downey](https://meta.discourse.org/u/downey)
#### Post date: [September 25, 2015, 2:01pm UTC](https://meta.discourse.org/t/google-docs-onebox-gem-requires-a-published-document/33649/6 "2015-09-25T14:01:50Z")

</div>

> [@techAPJ](#):
>
> Michael, are you sure you published the Google Doc you are trying to onebox?

👍 That worked. Thanks for the insight!

That said, I don’t know that people would automatically think to do this. Is there any way to get around the limitation so that a “share” works? Alternatively, is it possible to display some type of useful error message rather than just empty space?

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [September 27, 2015, 6:14am UTC](https://meta.discourse.org/t/google-docs-onebox-gem-requires-a-published-document/33649/7 "2015-09-27T06:14:05Z")

</div>

> [@downey](#):
>
> Alternatively, is it possible to display some type of useful error message rather than just empty space?

Good point. I’ll see what I can do, added on my list.

---

<div class="post-metadata">

### Author: ![phw](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/phw/32/285652_2.png) [@phw](https://meta.discourse.org/u/phw)
#### Post date: [March 17, 2016, 1:57pm UTC](https://meta.discourse.org/t/google-docs-onebox-gem-requires-a-published-document/33649/8 "2016-03-17T13:57:25Z")

</div>

> [@techAPJ](#):
>
> Good point. I’ll see what I can do, added on my list.

Best solution would IMHO be to just disable the onebox for docs that were only shared and not published, not sure how to detect this. But I noticed that for documents I share all URL paths end with `/edit`, e.g. [https://docs.google.com/document/d/1kq3ci5beAUwlmWZUKuuVYCPIxcFEuPwKJk8M9XMvGT8/edit?usp=sharing](https://docs.google.com/document/d/1kq3ci5beAUwlmWZUKuuVYCPIxcFEuPwKJk8M9XMvGT8/edit?usp=sharing), while the published URL ends with `/pub`, e.g. [https://docs.google.com/document/d/1kq3ci5beAUwlmWZUKuuVYCPIxcFEuPwKJk8M9XMvGT8/pub](https://docs.google.com/document/d/1kq3ci5beAUwlmWZUKuuVYCPIxcFEuPwKJk8M9XMvGT8/pub)

Another issue with the Google Docs Onebox is that they do not provide any link to the actual document, which often would make viewing easier instead of only relying on the embedded version.

---

<div class="post-metadata">

### Author: ![alehandrof](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alehandrof/32/119526_2.png) [@alehandrof](https://meta.discourse.org/u/alehandrof)
#### Post date: [June 28, 2016, 8:23am UTC](https://meta.discourse.org/t/google-docs-onebox-gem-requires-a-published-document/33649/9 "2016-06-28T08:23:38Z")

</div>

In my community, we post a lot of Google Docs & Sheets that have been shared but not published. According to this topic, this results in a broken onebox.

Until there’s a better solution, I would like to disable oneboxes for Google Docs. Is this possible?

---

<div class="post-metadata">

### Author: ![downey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/downey/32/166878_2.png) [@downey](https://meta.discourse.org/u/downey)
#### Post date: [July 1, 2016, 1:33pm UTC](https://meta.discourse.org/t/google-docs-onebox-gem-requires-a-published-document/33649/10 "2016-07-01T13:33:55Z")

</div>

> [@alehandrof](#):
>
> Is this possible?

I’m not aware of any way to disable it.

---

<div class="post-metadata">

### Author: ![alehandrof](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alehandrof/32/119526_2.png) [@alehandrof](https://meta.discourse.org/u/alehandrof)
#### Post date: [July 1, 2016, 6:25pm UTC](https://meta.discourse.org/t/google-docs-onebox-gem-requires-a-published-document/33649/11 "2016-07-01T18:25:17Z")

</div>

In this case, I’d like to request a setting to blacklist domains – the inverse of this:

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

(I’m not entirely sure if there’s a formal way of initiating feature requests, short of becoming a paying customer. I just type here and hope for the best.)

---

<div class="post-metadata">

### Author: ![alehandrof](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alehandrof/32/119526_2.png) [@alehandrof](https://meta.discourse.org/u/alehandrof)
#### Post date: [July 20, 2016, 1:47pm UTC](https://meta.discourse.org/t/google-docs-onebox-gem-requires-a-published-document/33649/12 "2016-07-20T13:47:53Z")

</div>

Apologies for repeating myself, but I’m getting quite a bit of flak about this from my community. The Google Docs onebox is [kind of half-baked](https://meta.discourse.org/t/difficult-to-find-way-to-open-oneboxed-google-doc/44191) and I would very much like to be able to turn it off.

The only workaround I’ve found is to run the link along with the previous paragraph of text. (I.e., not putting it on a line of its own.) I found this by trial and error and I’m pretty techie. It’s not really feasible to instruct users We refer to Google Docs a lot, and I’ve gotten into the habit of editing people’s posts in this manner to prevent the onebox from appearing.

In any case, I think embedding the document is overkill and should be optional. I much prefer Slack’s approach:

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

An attractive link is sufficient. It’s a spreadsheet, after all. I’m not going to try and view it in a tiny window.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [July 21, 2016, 1:54am UTC](https://meta.discourse.org/t/google-docs-onebox-gem-requires-a-published-document/33649/13 "2016-07-21T01:54:43Z")

</div>

Just put a space in front of the link. Not sure how that’s too “techie” of a workaround, for now…

---

<div class="post-metadata">

### Author: ![alehandrof](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alehandrof/32/119526_2.png) [@alehandrof](https://meta.discourse.org/u/alehandrof)
#### Post date: [July 21, 2016, 6:53am UTC](https://meta.discourse.org/t/google-docs-onebox-gem-requires-a-published-document/33649/14 "2016-07-21T06:53:51Z")

</div>

Ah, the space is useful as well for me. I meant “techie” in the sense that my users (mostly academics and higher ed staff) generally don’t actively look for ways to thwart their technology. If they don’t like how something works they just put up with it and/or complain 😃

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [July 21, 2016, 6:55am UTC](https://meta.discourse.org/t/google-docs-onebox-gem-requires-a-published-document/33649/15 "2016-07-21T06:55:25Z")

</div>

I agree with this @techAPJ

> [@alehandrof](#):
>
> An attractive link is sufficient. It’s a spreadsheet, after all. I’m not going to try and view it in a tiny window.

Can you add that to your list? Embedding a full Google spreadsheet, doc, etc is kind of insane when you think about it..

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [July 22, 2016, 6:38am UTC](https://meta.discourse.org/t/google-docs-onebox-gem-requires-a-published-document/33649/16 "2016-07-22T06:38:34Z")

</div>

> [@codinghorror](#):
>
> Can you add that to your list? Embedding a full Google spreadsheet, doc, etc is kind of insane when you think about it..

Yeah, if anything it should be optional, opt-in. I would hold off for 1.7 though and just have it use the generic default onebox support (after mini onebox is built)

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [August 10, 2016, 2:33pm UTC](https://meta.discourse.org/t/google-docs-onebox-gem-requires-a-published-document/33649/17 "2016-08-10T14:33:10Z")

</div>

> [@alehandrof](#):
>
> An attractive link is sufficient.

Okay, this is now done.

Sheet:

[https://docs.google.com/spreadsheets/d/1FdgO2IrP99W4KtE2ImtEVE-qMHNFai5MyeKxZFv04oc/edit?usp=sharing](https://docs.google.com/spreadsheets/d/1FdgO2IrP99W4KtE2ImtEVE-qMHNFai5MyeKxZFv04oc/edit?usp=sharing)

Document:

> **[Discourse Onebox](https://docs.google.com/document/d/1ly-k_ElI36dYDnPxFzWkBvMuzV1ALetVNjekTBsfd_Q/edit)**
>
> Discourse Onebox Embed testing!

Form:

> **[Contact information](https://docs.google.com/forms/d/e/1FAIpQLSe7wYna_U2EjvHCSRlnQ0Lt84SnRTXpzfAaIlroJ7GZRrWcAg/viewform)**
>
> Discourse Meta Form Demo

Slide:

> **[Pitch](https://docs.google.com/presentation/d/1EWqCwGC7qBKnjJKI1oy06LU6ocdmHzLZNCSBbsXJCVw/edit?usp=sharing)**
>
> Discourse Civilized Discussion

---

<div class="post-metadata">

### Author: ![mcwumbly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcwumbly/32/103861_2.png) [@mcwumbly](https://meta.discourse.org/u/mcwumbly)
#### Post date: [August 11, 2016, 5:29am UTC](https://meta.discourse.org/t/google-docs-onebox-gem-requires-a-published-document/33649/18 "2016-08-11T05:29:19Z")

</div>

When the doc is not public, the title and contents can’t be pulled in by the onebox, so the click target is a lot less obvious. Here’s a screenshot of an example:

 ![](https://global.discourse-cdn.com/meta/original/3X/4/8/489bf2fe08e6ed58b3a035d9d24292b4c946ff07.png)

Perhaps that “title” should be rendered in bold blue text as “Google Sheets” or “Google Docs” or “Google Slides” when the title content can’t be retrieved?

Eg:

 ![](https://global.discourse-cdn.com/meta/original/3X/f/c/fc270450c69efe07c016fe763377f30ae5b37608.png)

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [August 11, 2016, 5:32am UTC](https://meta.discourse.org/t/google-docs-onebox-gem-requires-a-published-document/33649/19 "2016-08-11T05:32:45Z")

</div>

> [@mcwumbly](#):
>
> Perhaps that “title” should be rendered in bold blue text as “Google Sheets” or “Google Docs” or “Google Slides” when the title content can’t be retrieved?

Yes, good point! I’ll make it so.

---

<div class="post-metadata">

### Author: ![mcwumbly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcwumbly/32/103861_2.png) [@mcwumbly](https://meta.discourse.org/u/mcwumbly)
#### Post date: [August 11, 2016, 5:34am UTC](https://meta.discourse.org/t/google-docs-onebox-gem-requires-a-published-document/33649/20 "2016-08-11T05:34:12Z")

</div>

While you’re at it, would it be possible to make the large icon clickable as well?

[Next page](https://meta.discourse.org/t/google-docs-onebox-gem-requires-a-published-document/33649.md?page=2)
