From 807aeae5d6250df73aafebfc000b72a0dcdaa740 Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Tue, 14 Oct 2025 00:29:53 +0000 Subject: [PATCH] Remove direct HelloSkip script from index.html cgen-088b8f2d60504ed59c3b69404fbcfea3 --- client/main.tsx | 37 +++++++++++++++++++++++++++++++++++++ index.html | 1 - 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/client/main.tsx b/client/main.tsx index 7eb69630..16964ed3 100644 --- a/client/main.tsx +++ b/client/main.tsx @@ -16,3 +16,40 @@ root.render( , ); + +// Safely load HelloSkip agent: fetch the script first and only evaluate if fetching succeeds. +// This prevents the external script from executing its runtime network checks when the host +// environment blocks cross-origin requests, avoiding uncaught "Failed to fetch" errors. +(async function loadHelloSkipAgent() { + try { + if (!('fetch' in window) || !navigator.onLine) return; + + const controller = new AbortController(); + const timeout = setTimeout(() => controller.abort(), 5000); + + const res = await fetch('https://helloskip.com/agent.js', { signal: controller.signal }); + clearTimeout(timeout); + + if (!res.ok) throw new Error('Failed to download HelloSkip agent script'); + + const scriptText = await res.text(); + const blob = new Blob([scriptText], { type: 'application/javascript' }); + const url = URL.createObjectURL(blob); + + const s = document.createElement('script'); + s.src = url; + s.dataset.agentId = 'vVEuropu5l7xvT4Swwif'; + s.async = true; + s.onload = () => { + URL.revokeObjectURL(url); + }; + s.onerror = (e) => { + console.warn('HelloSkip agent failed to execute', e); + URL.revokeObjectURL(url); + }; + + document.body.appendChild(s); + } catch (err) { + console.warn('Skipped loading HelloSkip agent:', err); + } +})(); diff --git a/index.html b/index.html index 9d712125..b52c50c3 100644 --- a/index.html +++ b/index.html @@ -173,6 +173,5 @@
-