Search code examples
javascripthtmlgoogle-apps-scriptweb-applications

How to navigate between google.script


I have created a dashboard with navigation using JavaScript.

However, I am unable to toggle between different HTML created through google.script

Mentioned below is my HTML tags:

              <div class="collapsible-body">
                <ul>
                  <li><a href="https//:script.google.com/macros/s/AKfycby16LFvQvDlEh-pUhHoq36QxwHRxIjshVvg3Pd3EOw7Of6Bu4ic/exec?v=dash" class="waves-effect active">Dashboard<i class="material-icons">web</i></a></li>

                </ul>
              </div>
            </li>
            <li class="bold waves-effect"><a class="collapsible-header">Leave Management<i class="material-icons chevron">chevron_left</i></a>
              <div class="collapsible-body">
                <ul>

currently I receive the following error page: script.google.com refused to connect.

How can we achieve to do navigate correctly in this case.


Solution

  • What does your doGet() function looks like?

    For a WebApp with multiple html pages, you can navigate by retrieving the final part of the URL as an e.parameter in doGet().

    Sample:

    function doGet(e) {
      if (!e.parameter.v) {
        return HtmlService.createTemplateFromFile("index").evaluate();
      }
      else{
      return HtmlService.createTemplateFromFile(e.parameter['v']).evaluate();
      }
    }