Embed Instructions
How to Embed the Quote Form
Copy and paste this code into your website where you want the quote form to appear. The iframe will automatically resize as users navigate through the quote process.
<!-- The Storage Box Quote Form Embed -->
<div id="tsb-quote-container" style="width: 100%; min-height: 800px;">
<iframe
id="tsb-quote-iframe"
src="https://app.thestoragebox.com"
style="width: 100%; border: none; display: block; height: 800px;"
scrolling="no"
></iframe>
</div>
<script>
(function() {
const iframe = document.getElementById('tsb-quote-iframe');
const container = document.getElementById('tsb-quote-container');
// Listen for height updates, scroll commands, and UTM requests from iframe
window.addEventListener('message', function(event) {
// Security: validate origin in production
// if (event.origin !== 'https://your-expected-origin.com') return;
if (event.data.type === 'iframe-resize' && event.data.height) {
const newHeight = event.data.height + 'px';
iframe.style.height = newHeight;
container.style.minHeight = newHeight;
console.log('Iframe resized to:', newHeight);
}
if (event.data.type === 'scroll-to-top') {
// Scroll the page so iframe top is visible
const iframeTop = iframe.getBoundingClientRect().top + window.pageYOffset;
window.scrollTo({ top: iframeTop, behavior: 'smooth' });
console.log('Scrolled to iframe top');
}
// Pass parent page URL to iframe so it can capture UTM/fbclid params
if (event.data.type === 'TSB_REQUEST_URL') {
iframe.contentWindow.postMessage({
type: 'TSB_PARENT_URL',
url: window.location.href
}, '*');
}
}, false);
// Initial resize after iframe loads
iframe.addEventListener('load', function() {
console.log('Iframe loaded');
});
})();
</script>Features:
- ✓ Automatic height adjustment as content changes
- ✓ Smooth scrolling to top when new pages load
- ✓ No scrollbars within the iframe
- ✓ Seamless user experience
Important Notes:
- • For production, uncomment and set the origin validation in the script
- • The container has a minimum height to prevent layout shifts
- • Messages are sent via postMessage for cross-origin communication
