Google Apps Script - ScriptApp.getService().getUrl() not working when included

186 views Asked by At

I have made a sidnav for this webapp and used the method to have it on Multiple pages. Everything is loading correctly except for the ScriptApp.getService().getUrl(). Instead of getting the URL, it is just returning it as text

enter image description here

Instead of this enter image description here

The code for the links

<li><a href="<?= ScriptApp.getService().getUrl(); ?>?v=salespipe">Sales Pipeline</a></li>
<li><a href="<?= ScriptApp.getService().getUrl(); ?>?v=projects">Projects</a></li>

Is there something really straightforward that I am doing wrong? It would really save a lot of time if I could use the include code instead of updating each page manually

1

There are 1 answers

1
Jacques-Guzel Heron On

If your goal is to insert an Apps Script/Javascript code into your HTML, try the following:

<li><a href="javascript:ScriptApp.getService().getUrl();?v=salespipe">Sales Pipeline</a></li>
<li><a href="javascript:ScriptApp.getService().getUrl();?v=projects">Projects</a></li>