From 623149dc176d93eae13573035d946e057c25a884 Mon Sep 17 00:00:00 2001 From: Dayowe Date: Sun, 8 Jun 2025 23:02:57 +0200 Subject: [PATCH] embed url --- dog-food-calculator-widget.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dog-food-calculator-widget.js b/dog-food-calculator-widget.js index 0c4090e..e30b6ca 100644 --- a/dog-food-calculator-widget.js +++ b/dog-food-calculator-widget.js @@ -1546,13 +1546,16 @@ const iframeCode = document.querySelector('#iframeCode'); if (modal && widgetCode && iframeCode) { - const baseUrl = window.location.origin; + // Extract domain from current URL to build embed subdomain + const hostname = window.location.hostname; + const protocol = window.location.protocol; + const embedUrl = `${protocol}//embed.${hostname}`; const theme = this.theme !== 'system' ? ` data-theme="${this.theme}"` : ''; - widgetCode.textContent = ` + widgetCode.textContent = `
`; - iframeCode.textContent = `