79659355

Date: 2025-06-09 18:32:22
Score: 2.5
Natty:
Report link
Hello,
Thank you for your reply. I made the changes and it still doesn't work. Below is my code:

Html
<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Grau d'Agde ☂️</title>

    <!-- =================================================================== -->
    <!--         LA MÉTHODE SIMPLE ET DIRECTE - SANS JAVASCRIPT          -->
    <!-- =================================================================== -->
    <!-- Le serveur va directement insérer les URLs ici, dans les balises. -->
    
    <link rel="manifest" href="<?= manifestUrlForJs ?>">
    <link rel="apple-touch-icon" href="<?= appleIconUrlForJs ?>">


    <!-- =================================================================== -->

    <style>
        body, html { margin: 0; padding: 0; height: 100%; overflow: hidden; display: flex; flex-direction: column; font-family: Arial, sans-serif; background-color: #FFFFFF; }
        #header { background-color: #4A6B82; color: white; padding: 18px; text-align: center; font-size: 1.4em; font-weight: bold; border-bottom: 2px solid #374E60; }
        #iframe-container { flex: 1; border: none; }
        .spinner-container { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; background-color: #FFFFFF; }
        .spinner { border: 8px solid #f3f3f3; border-top: 8px solid #3498db; border-radius: 50%; width: 60px; height: 60px; animation: spin 1.2s linear infinite; margin-bottom: 20px; }
        @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
        #loading-text { font-size: 2em; color: #333; }
    </style>
</head>
<body>
    <div id="header">Grau d'Agde ☂️</div>
    <div id="loading-message-container" class="spinner-container">
        <div class="spinner"></div>
        <div id="loading-text">Chargement...</div>
    </div>
    <iframe id="iframe-container" src="about:blank" style="display:none;"></iframe>

    <!-- Le script pour gérer l'iframe reste ici, car il a besoin que le body existe. -->
    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const targetUrl = <?!= JSON.stringify(targetUrl) ?>;
            const iframeContainer = document.getElementById('iframe-container');
            const loadingContainer = document.getElementById('loading-message-container');
            const loadingText = document.getElementById('loading-text');

            if (targetUrl) {
                iframeContainer.src = targetUrl;
            } else {
                const spinnerElement = loadingContainer.querySelector('.spinner');
                if(spinnerElement) spinnerElement.style.display = 'none';
                loadingText.textContent = "Erreur: URL cible non configurée.";
                loadingText.style.color = 'red';
                loadingContainer.style.display = "flex";
                iframeContainer.style.display = "none";
                return;
            }
            iframeContainer.onload = function() {
                loadingContainer.style.display = "none";
                iframeContainer.style.display = "block";
            };
            iframeContainer.onerror = function() {
                const spinnerElement = loadingContainer.querySelector('.spinner');
                if(spinnerElement) spinnerElement.style.display = 'none';
                loadingText.textContent = "Erreur de chargement de la page.";
                loadingText.style.color = 'red';
                loadingContainer.style.display = "flex";
                iframeContainer.style.display = "none";
            };
        });
    </script>
</body>
</html>

doGet:
function doGet(e) {
  try {

    return serveManifest(); // POINT DE SORTIE 1
  }
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheetByName('Feuille 1');

  const IFRAME_TARGET_URL  = getValeurDepuisAutreFeuille()

  const appUrl = PropertiesService.getScriptProperties().getProperty('APP_URL');

 
  if (!appUrl || !IFRAME_TARGET_URL) {
    return HtmlService.createHtmlOutput( // POINT DE SORTIE 2
      '<h1>Erreur de Configuration</h1><p>Les URLs ne sont pas sauvegardées. Veuillez exécuter la fonction "saveDataToProperties" depuis l\'éditeur de script.</p>'
    );
  }


  const APPLE_ICON_ID = "1d3YFdHEncn3-_kUsw3rPMvRQDwF9YKmE";
  const FAVICON_ID = "1uLI9a2krUi6HlDnRIYXj7EXQIEW_juz6";


  let htmlTemplate = HtmlService.createTemplateFromFile('lanceur');
  
  // 6. PASSER LES VARIABLES AU TEMPLATE
  htmlTemplate.targetUrl = IFRAME_TARGET_URL;
  htmlTemplate.manifestUrlForJs = `${appUrl}?page=manifest`;
  htmlTemplate.appleIconUrlForJs = `https://drive.google.com/uc?export=view&id=${APPLE_ICON_ID}`;


  return htmlTemplate.evaluate()
      .setFaviconUrl(`https://drive.google.com/uc?id=${FAVICON_ID}&export=view&format=png`)  
      .setTitle("Grau d'Agde ☂️");

  

  } catch (e) {

    return HtmlService.createHtmlOutput(
      '<pre style="font-family: monospace; font-size: 1.2em; color: red;">' +
      'UNE ERREUR FATALE EST SURVENUE :\n\n' +
      'MESSAGE : ' + e.message + '\n\n' +
      'LIGNE   : ' + e.lineNumber + '\n\n' +
      'FICHIER : ' + e.fileName + '\n\n' +
      'PILE D\'APPELS (STACK) :\n' + e.stack +
      '</pre>'
    );
  }
}
Reasons:
  • Blacklisted phrase (0.5): Thank you
  • RegEx Blacklisted phrase (2): it still doesn't work
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: stephane golonka