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