Thanks, Ben!
So I’ve been speaking with ScoreApp and am waiting to hear back from one of their developers. I actually think their embed code is fine, I tested it by adding it to the Footer HTML in advanced settings and it displayed fine.
Here’s a link to the Hubspot page I’m building:
http://expocast.hubspotpagebuilder.com/for-clients
You should be able to tell which is the embedded content as it is sitting inside it’s own scroll bar.
Here’s the embed code from ScoreApp:
<div data-sa-url=“https://22859e71-0d64-4ce2-b5e5-a0d45502c046.scoreapp.com/?sa_hide_header=1&sa_hide_footer=1&sa_target=_top” data-sa-view=“inline” style=“max-width: 100%; width: 100%” data-sa-auto-height=“1”></div>
<script src=“https://static.scoreapp.com/js/integration/v1/embedding.js?v=GvVUxp”></script>
I’m wondering whether there’s something that needs changing on the html moduel I built in the Design Manager:
Here’s the full contents of the HTML + HubL section:
{% if module.embed_field.source_type == “oembed” %}
{% set oembedResponse = module.embed_field.oembed_response %}
<div class=“oembed_container {% if module.embed_field.size_type == ‘auto_full_width’ %} oembed_container–full-size{% endif %}” id=“oembed_container-{{name|escape_attr}}”>
<div class=“iframe_wrapper”
data-embed-response-html=“{{ oembedResponse.html|escape_attr }}”
data-embed-response-width=“{{ oembedResponse.width|escape_attr }}”
data-embed-response-height=“{{ oembedResponse.height|escape_attr }}”
data-embed-url=“{{ module.embed_field.oembed_url|escape_attr }}”
{% unless module.embed_field.size_type == “auto_full_width” || module.embed_field.size_type == “exact” %}
data-max-height=“{% if module.embed_field.size_type == “auto_custom_max” %}{{ module.embed_field.max_height|escape_attr }}{% endif %}”
data-max-width=“{% if module.embed_field.size_type == “auto_custom_max” %}{{ module.embed_field.max_width|escape_attr }}{% endif %}”
{% endunless %}
{% if module.embed_field.size_type == “exact” %}
data-height=“{{ module.embed_field.height|escape_attr }}”
data-width=“{{ module.embed_field.width|escape_attr }}”
{% endif %}
>
</div>
</div>
{% require_css %}
<style>
.oembed_container {
display: inline-block;
height: 100%;
position: relative;
width: 100%;
}
.oembed_container .iframe_wrapper > * {
height: 100%;
left: 0;
margin: 0 auto;
position: absolute;
right: 0;
top: 0;
width: 100%;
}
.iframe_wrapper {
height: 0;
padding-bottom: 56.25%;
padding-top: 25px;
position: relative;
}
</style>
{% end_require_css %}
{% require_js %}
<script>
function loadEmbedField(oembedContainer) {
const iframeWrapper = oembedContainer.querySelector(‘.iframe_wrapper’);
if (!iframeWrapper) {
return;
}
const url = iframeWrapper.dataset.embedUrl;
if (!url) {
return;
}
function setIframe(data) {
let {
maxHeight,
maxWidth,
height,
width,
} = iframeWrapper.dataset;
maxHeight = maxHeight !== undefined && !maxHeight ? data.height : maxHeight;
maxWidth = maxWidth !== undefined && !maxWidth ? data.width : maxWidth;
height = height !== undefined && !height ? data.height : height;
width = width !== undefined && !width ? data.width : width;
const el = document.createElement(‘div’);
el.innerHTML = data.html;
const iframe = el.firstChild;
iframeWrapper.appendChild(iframe);
if (maxHeight) {
const maxHeightStr = maxHeight.toString(10) + “px”;
oembedContainer.style.maxHeight = maxHeightStr;
iframe.style.maxHeight = maxHeightStr;
}
if (maxWidth) {
const maxWidthStr = maxWidth.toString(10) + “px”;
oembedContainer.style.maxWidth = maxWidthStr;
iframe.style.maxWidth = maxWidthStr;
}
if (height) {
const heightStr = height.toString(10) + “px”;
oembedContainer.style.height = heightStr;
iframe.style.height = heightStr;
}
if (width) {
const widthStr = width.toString(10) + “px”;
oembedContainer.style.width = widthStr;
iframe.style.width = widthStr;
}
}
const embedResponse = {
html: iframeWrapper.dataset.embedResponseHtml,
width: iframeWrapper.dataset.embedResponseWidth,
height: iframeWrapper.dataset.embedResponseHeight
};
if (embedResponse.html) {
setIframe(embedResponse);
return;
}
const request = new XMLHttpRequest();
const requestUrl = “/_hcms/oembed?url=” + encodeURIComponent(url) + “&autoplay=0”;
request.open(‘GET’, requestUrl, true);
request.onload = function() {
if (request.status >= 200 && request.status < 400) {
const data = JSON.parse(request.responseText);
setIframe(data);
} else {
console.error(‘Server reached, error retrieving results.’);
}
};
request.onerror = function() {
console.error(‘Could not reach the server.’);
};
request.send();
}
document.addEventListener(‘DOMContentLoaded’, function() {
var oEmbedContainers = document.getElementsByClassName(‘oembed_container’);
Array.prototype.forEach.call(oEmbedContainers, loadEmbedField)
});
</script>
{% end_require_js %}
{% else %}
<div id=“embed_container” class=“embed_container”>
<div class=“iframe_wrapper”>
{{ module.embed_field.embed_html }}
</div>
</div>
{% require_css %}
<style>
.iframe_wrapper {
height: 0;
padding-bottom: 56.25%;
padding-top: 25px;
position: relative;
}
.embed_container {
display: inline-block;
height: 100%;
position: relative;
width: 100%;
}
.embed_container iframe {
left: 0;
max-height: 100%;
max-width: 100%;
position: absolute;
right: 0;
top: 0;
}
</style>
{% end_require_css %}
{% endif %}