Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

224
Vistas
Form Field Does Not Complete By URL In Iframe or Google Site - but does as independent web app

I am trying to complete a form created in google app script web app via URL with the intention to display the field but be inactive and a UUID for form submit.

In web app testing the form is completed by URL eg: https://script.google.com/macros/s/AKfycbwam4eZHPrs2ooVQLzJZgMcFb9gfXC2OPSq8f7Xkp9z/dev?fn=bob filling "bob" into field "fn".

However to remove googles "This application was created by another user, not by Google.Terms of Service" we put the web app in and iframe or link in google sites. This throws a spanner in the works.

Any advise will be much appreciated


    function doGet() {
      return HtmlService.createTemplateFromFile("page").evaluate().setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);
    }
    
    
    function userClicked(userInfo){
     
      const url = "https://docs.google.com/spreadsheets/d/1-7D4bXhm1Yx0ekRUmrwr8fTsdQ0dLtMI4gYG-THPUdk/edit#gid=0";
      const ss = SpreadsheetApp.openByUrl(url);
      const ws = ss.getSheetByName("data");
     
     ws.appendRow([userInfo.firstName,userInfo.lastName,userInfo.app,new Date()])
    
     // Logger.log(name + " Clicked The Button");
    
    }
    
    function include(filename){
      return HtmlService.createHtmlOutputFromFile(filename).getContent();
    
    }
    <script>

        document.addEventListener('DOMContentLoaded', function() {
          var elems = document.querySelectorAll('select');
          var instances = M.FormSelect.init(elems);
        });

      document.getElementById("btn").addEventListener("click",doStuff);

      function doStuff(){

        const userInfo = {};

        userInfo.firstName = document.getElementById("fn").value;
        userInfo.lastName = document.getElementById("ln").value;
        userInfo.app = document.getElementById("app").value;

        google.script.run.userClicked(userInfo);

        document.getElementById("fn").value = "";
        document.getElementById("ln").value = "";

        var myApp = document.getElementById("app");
        myApp.selectedIndex = 0;
        M.FormSelect.init(myApp);

      }


    </script>

      <script>
        google.script.url.getLocation(function(location){

          document.getElementById('fn').value = location.parameters.fn[0]
          document.getElementById('ln').value = location.parameters.ln[0]
        })

        </script>
about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Unfortunately there is no way to pass a query string parameter into a Google Apps Script web app embedded in Google Sites but this might be done by using client-side JavaScript on a "regular" web page.

Note: Use the /exec URL, not the /dev one.

<body onload="loadIframe();">
   
    <div id="content">
        <iframe width="100%" height="100%" frameborder="0"></iframe>
    </div>
    <script>
    function loadIframe(){
        const url = "put_here_your_web_app_url" + window.location.search;
        document.querySelector('iframe').src = url;
    }
    </script>
</body>

Related

  • Google Apps Script Gadget URL parameters are ignored when embedded in a Google Site
  • google site: pass parameters to embedded script
  • Google Apps script get Parent URL to iFrame in Javascript
about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda