From 95ab0b68aeaf374d3bd4b9a9d1e4f3a389c060d8 Mon Sep 17 00:00:00 2001 From: syoul Date: Tue, 9 Dec 2025 15:50:33 +0100 Subject: [PATCH] fix: charger team.html via fetch au lieu de redirection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Le reverse proxy redirige /team.html vers /team, créant une boucle. Solution: fetch le contenu de team.html et l'injecter dans le DOM avec document.write() pour remplacer complètement la page. --- public/team-block-script.js | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/public/team-block-script.js b/public/team-block-script.js index 0cc0038..6682f92 100644 --- a/public/team-block-script.js +++ b/public/team-block-script.js @@ -1,19 +1,40 @@ -// SCRIPT ÉQUIPE - REDIRECTION VERS team.html +// SCRIPT ÉQUIPE - CHARGEMENT DYNAMIQUE DE team.html (function() { 'use strict'; - // DÉTECTION PAGE ÉQUIPE (mais PAS team.html) var path = window.location.pathname; var isTeamRoute = path === '/team' || path === '/team/' || path.startsWith('/team/'); - var isTeamHtml = path === '/team.html'; - if (isTeamRoute && !isTeamHtml) { - console.log('🔄 ÉQUIPE: Redirection vers /team.html'); - window.location.replace('/team.html'); + if (!isTeamRoute) { return; } - if (isTeamHtml) { - console.log('✅ ÉQUIPE: Page team.html chargée directement'); + console.log('🔄 ÉQUIPE: Chargement du contenu team.html'); + + // Charger le contenu de team.html via fetch + function loadTeamContent() { + fetch('/team.html') + .then(function(response) { + if (!response.ok) throw new Error('HTTP ' + response.status); + return response.text(); + }) + .then(function(html) { + console.log('✅ ÉQUIPE: Contenu team.html chargé'); + + // Remplacer tout le document + document.open(); + document.write(html); + document.close(); + }) + .catch(function(error) { + console.error('❌ ÉQUIPE: Erreur chargement:', error); + }); + } + + // Charger immédiatement + if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', loadTeamContent); + } else { + loadTeamContent(); } })();