1
votes

I have a simple test google apps script that prints the content of a sheet. It works fine in Safari on Mac but on Chrome I get a blank page with this error in the console:

dropping postMessage.. was from unexpected window

This is the code:

    function doGet() {
  return HtmlService
      .createTemplateFromFile('index')
      .evaluate();
}

function getData() {
  return SpreadsheetApp
      .openById('1vyrKW7ABfCDY-a8H4AZ2JFZwA7lpCEuD6R5x4fJ8_qI')
      .getActiveSheet()
      .getDataRange()
      .getValues();
}

Here is the HTML template:

<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
  </head>
  <body>
    <? var data = getData(); ?>
    <table>
      <? for (var i = 0; i < data.length; i++) { ?>
        <tr>
          <? for (var j = 0; j < data[i].length; j++) { ?>
            <td><?= data[i][j] ?></td>
          <? } ?>
        </tr>
      <? } ?>
    </table>
  </body>
</html>

And here is the published web app: https://script.google.com/macros/s/AKfycbyYiAlqtqElFeyiWD6yq2zWtzQ1vdJMkHUPOfZrQFvicTO_uXs/exec

1
So clicking on the link with Chrome should lead you to that error? I cannot reproduce, seems to work fine for me. - Robin Gertenbach
Yes, I tried on two macs and didn't work on either - zorro2b
Ah, ok so then the problem seems to be limited on Chrome on Macs, I have a windows machine. - Robin Gertenbach

1 Answers

3
votes

It is a known issue with the latest version of Google Chrome. If you open the web app inside Firefox, it would work just fine.

Please star this issue on code.google.com for updates.