Struggling with height of embedded content

Hi,

I am trying to embed a landing page within a HubSpot webpage. I have managed to build a custom html module in HubSpot that will allow me to set the embedded content to full width, but it is not allowing the full height of the embedded content, instead I have to scroll a secondary scroll bar within the webpage to see all of the content.

Is there a solution to this? I think it might be something I need to put in the ‘module.css’ section of the html module I have built but I don’t know what it should be, I am very much learning as I go!

Some additional info that might be useful:

The content I am trying to embed is from ScoreApp, and they provide the embed code specifically so that it can be embedded into a website. My code is set for 100% width and auto-height.

I can share the embed code they generated if that is helpful to anyone. The code works how it should, just not the height.

Thanks in advance!

With regards to making a responsive embed, we would need to see the page and code to determine what is going on if it is not working as expected. Without the code we can only speculate as to what is going on. Being that this code is likely being generated from your Scoreapp solution, you might want to involve them about how their embed is rendering. It is possible based on their code and design, that it might not work as you are intending without changes on their end. Depending on the code (embed + what’s in the frame) we could see if that’s the case.

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 %}

I’m not seeing anything jumping out initially at me but I can take a deeper look in a bit. But from a CX perspective the whole iframe seems unnecessary as that content should be on page especially since you end up with a form in the iframe that loads to a new window website outside of that page. Then you are double counting your hubspot analytics as the scoreapp has a hubspot integration and the first line of the iframe is the hubspot analytics script.

Thanks again, Ben - massively appreciate the help!

Bear in mind I’m pretty much clueless about coding, is it possible for me to just delete the lines that are responsible for adding in the iframe if it’s not necessary?


@mrmrfrost wrote:

Thanks again, Ben - massively appreciate the help!

Bear in mind I’m pretty much clueless about coding, is it possible for me to just delete the lines that are responsible for adding in the iframe if it’s not necessary?


What I was suggesting is that you could just replace all the iframe content with your own as the first part is just designed HTML that you could likely put into Hubspot. The catch is that first form. I don’t know whether you can pass that information to scoreapp via UTM parameters to know who is submitting, or you may the first page of the scoreapp processs the form instead of going to the first question. From looking a zapier integration may be able to bridge this gap for you without the iframe to link data together between the platforms.