0
votes

I have this code and it has been working for months but all of a sudden it stopped working and I can't figure out why. It will display nothing when it is embedded on a google site.

function doGet() {

   return HtmlService.createHtmlOutputFromFile('220')
  .setSandboxMode(HtmlService.SandboxMode.IFRAME);
}

This then should get the .html file in the same script labeled 220.I will show it below.

<!DOCTYPE html>
<html>
  <head>
    <title>Campus Center Calendar</title>
    <meta charset='utf-8' />
  </head>
  <body>
    <p id="demo"></p>
    <script>

    var date = new Date(); 
    var year = date.getFullYear(); 
    var month = date.getMonth(); 
    month=month+1; 
    if (month < 10) 
    month = "0" + month; 
    var day= date.getDate(); 
    if (day < 10) 
    day = "0" + day; 
    var datestring=year+month+day;

    document.write('<iframe src="https://calendar.google.com/calendar/embed?height=600&amp;wkst=1&amp;bgcolor=%23FFFFFF&amp;src=mc817dld6jbb91lku4cei8h9n7eriqbl%40import.calendar.google.com&amp;color=%232952A3&amp;ctz=America%2FNew_York&amp;mode=DAY&amp;dates='+datestring+'%2F'+datestring+'&amp;showTz=0&amp;showPrint=0&amp;showTabs=0&amp;showTitle=0&amp;showNav=0&amp;showDate=0&amp;showCalendars=0" style="border-width:0" width="300" height="900" frameborder="0" scrolling="no"><\/iframe>');


    </script>

  </body>
</html>

Code picture (click here)

html picture (click here)

This is supposed to let me embed a app script to google sites and when this runs make a iframe with the calendar being displayed in day view with the current date.

THANK YOU FOR THE HELP!

1

1 Answers

0
votes

I think that dates which is one of query parameters is the reason of your problem. In your script for retrieving the parameter of dates, when the month became October, the variable of month is used as a number. So for example, Oct. 6, 2017 becomes 202706. This occurs an error. So your script doesn't work. When this is reflected to your script, please modify your script of 220.html as follows.

From :

var datestring=year+month+day;

To :

var datestring = year + month.toString() + day.toString();

If this was not useful for you, I'm sorry.