1

I am implementing a HTML sidebar and Modal dialogue in an Appscript Project bound to a Google Sheet. The HTML pages call scripts from my scripts.gs file in two different ways - onload and onclick. Both of these work fine in Chrome 89.0.4389.90 (Official Build) (64-bit) on Windows. However, they don't execute at all in Firefox 78.9.0esr (64-bit) on Windows or Safari on Mac.

Looking at the Console log in Chrome only shows Net state changed from IDLE to BUSY when the script executes. Firefox logs Uncaught ScriptError: We're sorry, a server error occurred. Please wait a bit and try again.

Here are the scripts in the modal:

<script>
    window.onload = function(){
      google.script.run.withSuccessHandler(userData).getNewAccountRecord();
    }
    function userData(recordArray) {
      showData(recordArray, 'data')
    }    
    function showData(recordArray, divName){
      var html = "";
      var record;
      html = "<table>"
      for(j=0; j<recordArray.length; j++) {
        record = recordArray[j];
        for (var i=0; i<record.headerArray.length; i++) {
        if (record.dataArray[i] != "") {
          html += `<tr><td>${record.headerArray[i]}:</td><td class="copytext" onClick="copyStringToClipboard('${record.dataArray[i]}')" > ${record.dataArray[i]}</td>`;
          //html += `<br>${record.headerArray[i]}: <span onClick="copyStringToClipboard('${record.dataArray[i]}')">${record.dataArray[i]}</span>`;
        }
      }
      }
      html += "</table>"
      document.getElementById(divName).innerHTML = html;
    }
    function copyStringToClipboard (str) {
        var el = document.createElement('textarea');
        el.value = str;
        el.setAttribute('readonly', '');
        el.style = {position: 'absolute', left: '-9999px'};
        document.body.appendChild(el);
        el.select();
        document.execCommand('copy');
        document.body.removeChild(el);
        }
</script>

The getNewAccountRecord() function is in my scripts.gs file and executes beautifully on Chrome.

Any thoughts?

Notes

  • This project does use an external library (version, not head deployment) though none of the scripts this is referencing are in that external library.
  • google.script.host.close() does execute properly when called thru an onmousedown button
  • Using V8 runtime engine

Appreciate any insights.

Tyler

Tyler LV
  • 11
  • 2
  • Miscopied the var record declaration. In Chrome it generaetes a table with values (and the onclicks do work) whereas in firefox/safari it generates nothing. – Tyler LV Apr 13 '21 at 15:07
  • Tried converting it all to buttons - no difference. – Tyler LV Apr 13 '21 at 18:54
  • I tried an Private Browsing firefox session and it worked. Assumei that a second google account session may be the culprit. – Tyler LV Apr 14 '21 at 16:57
  • I've also got this issue. But with only a single window open in Safari. If I open a private window, and am also logged in via Chrome, my script still doesn't work. If I don't have any other session logged in - then for some users it appears to work. – Sean Apr 05 '23 at 13:59
  • This question is being discussed in [official chat room](https://chat.stackoverflow.com/transcript/message/56179947#56179947) – TheMaster Apr 19 '23 at 02:54

0 Answers0