# Attention Onebox experts: Help requested resizing an iFrame embedded via oEmbed

**URL:** <https://meta.discourse.org/t/attention-onebox-experts-help-requested-resizing-an-iframe-embedded-via-oembed/45603>\
**Category:** Development\
**Created:** [6월 13, 2016, 4:35오후 UTC](https://meta.discourse.org/t/attention-onebox-experts-help-requested-resizing-an-iframe-embedded-via-oembed/45603 "2016-06-13T16:35:41Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![Ross\_Boucher](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ross_boucher/32/120839_2.png) [@Ross\_Boucher](https://meta.discourse.org/u/Ross_Boucher)\
**Post date:** [7월 7, 2017, 2:02오후 UTC](https://meta.discourse.org/t/attention-onebox-experts-help-requested-resizing-an-iframe-embedded-via-oembed/45603/13 "2017-07-07T14:02:02Z")

</div>

Reviving an old thread: I’d like the same functionality, dynamically resized iframes. Since it seems allowing oembed providers to include script tags isn’t likely to happen (which I completely understand), a reasonable alternative would be for Discourse to implement a pretty simple hook.

Embed.ly provides this functionality by just sending a fairly simple postMessage, and on the host page, their library includes essentially this snippet:

```plaintext
window.addEventListener('message', function(e) {
  var data;
  try {
    data = JSON.parse(e.data);
  } catch (e) {
    return false;
  }

  if (data.context !== 'iframe.resize') {
    return false;
  }

  var iframe = document.querySelector('iframe[src="' + data.src + '"]');

  if (!iframe) {
    return false;
  }
 
  if (data.height) {
    iframe.height = data.height;
  }
});

```

Discourse could implement something compatible with this same message and a lot of things that work with embed.ly would just automatically work. From the implementor’s perspective, it’s as simple as sending this JSON whenever your iframe needs to be resized:

```plaintext
{
  "src": window.location.toString(),
  "context": "iframe.resize",
  "height": 999
}

```

---

_[View the full topic](https://meta.discourse.org/t/attention-onebox-experts-help-requested-resizing-an-iframe-embedded-via-oembed/45603)._
