From 12a724614daa12630fa64b0127b75b0c9e61fa08 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Mon, 18 May 2026 15:38:32 +0200 Subject: [PATCH] =?UTF-8?q?F=C3=BCge=20Fallback-Logik=20f=C3=BCr=20Anzeige?= =?UTF-8?q?n=20hinzu:=20Lade=20iframe-Backup,=20wenn=20nach=203s=20kein=20?= =?UTF-8?q?Ad=20im=20Platzhalter=20erscheint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/components/HeaderAdBanner.vue | 27 ++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/client/src/components/HeaderAdBanner.vue b/client/src/components/HeaderAdBanner.vue index 812658e..49e38f0 100644 --- a/client/src/components/HeaderAdBanner.vue +++ b/client/src/components/HeaderAdBanner.vue @@ -167,6 +167,33 @@ async function renderPropeller() { // Start observing shortly after script insertion to allow provider to run setTimeout(observeAndRelocate, 100); + + // Fallback: wenn nach Script‑Load innerhalb 3s kein Ad im Placeholder erscheint, + // lade ein iframe‑Backup. Das erhöht die Chance, ein sichtbares Banner im Header zu zeigen. + setTimeout(() => { + try { + const ph = adContainer.value.querySelector('.propeller-ad-placeholder'); + const hasChild = ph && ph.children && ph.children.length > 0; + const height = ph ? parseInt(getComputedStyle(ph).height || '0', 10) : 0; + if (!hasChild && (!height || height === 0)) { + console.log('Ad placeholder empty — inserting iframe fallback'); + const iframe = document.createElement('iframe'); + iframe.width = '100%'; + iframe.height = '90'; + iframe.frameBorder = '0'; + iframe.scrolling = 'no'; + iframe.style.border = '0'; + iframe.title = 'Advertisement'; + // Fallback URL: attempt to call tag URL with slot param — may be accepted by provider + iframe.src = `${propScriptUrl}?slot=${encodeURIComponent(propSlotId)}&responsive=1`; + ph.innerHTML = ''; + ph.appendChild(iframe); + try { window.dispatchEvent(new CustomEvent('ads:fallback-inserted',{detail:{provider:'propeller',zone:propSlotId}})); } catch {} + } + } catch (e) { + console.warn('Fallback insertion failed', e); + } + }, 3000); } catch (err) { console.warn('Propeller ad load failed', err); }