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.
41 lines
1.1 KiB
JavaScript
41 lines
1.1 KiB
JavaScript
// SCRIPT ÉQUIPE - CHARGEMENT DYNAMIQUE DE team.html
|
|
(function() {
|
|
'use strict';
|
|
|
|
var path = window.location.pathname;
|
|
var isTeamRoute = path === '/team' || path === '/team/' || path.startsWith('/team/');
|
|
|
|
if (!isTeamRoute) {
|
|
return;
|
|
}
|
|
|
|
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();
|
|
}
|
|
})();
|