Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

276
Visualizações
how to redirect to another page using google web script?

I made successful code to redirect to another page using web script just in case I add query string manually. like this [main url]?Page=Partial

the doGet code

  function doGet(e) {
    var template;
    var pageName = e.parameter.page === undefined ? "Index" : e.parameter.page;  
    if (pageName === "Index") {
      template = HtmlService.createTemplateFromFile(pageName);
    }else{
      var url = ScriptApp.getService().getUrl();
      var getPageUrl = url + "?page=" + pageName;
      template = HtmlService.createTemplateFromFile(pageName);
      template.url = getPageUrl;
    }

    return template.evaluate();
  }

but when I try to href using anchor element It never work

  function href(pageName){
      var url = ScriptApp.getService().getUrl();
      var fullPageUrl = url + "?page=" + pageName;
      return fullPageUrl;
  }

then I use this in Index.html like this

 <a href="<?= href('Partial') ?>"></a>

notes:
if I do inspect for the page and click the href link it works well, but clicking directedly never work and come back with a page with error Forbidden Error 403

clicking href link content, when inspect page, or changing url manually only the successful ways to redirect to another page. and it never works by clicking directly on the href element and it comes back instead with error Forbidden Error 403

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda