我们有以下脚本,我们正在谷歌脚本编辑器中运行它,它工作正常,但它只打开一个网址,如果我们想打开多个网址,我们该怎么做
函数是
function myFunction() {
var js = " \
<script> \
window.open('https://stackoverflow.com/', '_blank', 'width=800, height=600'); \
google.script.host.close(); \
</script> \
";
var html = HtmlService.createHtmlOutput(js)
.setHeight(10)
.setWidth(100);
SpreadsheetApp.getUi().showModalDialog(html, 'Now loading.');
}
With window.open
你可以打开任意数量的窗口
在两个不同窗口中打开两个 url 的示例:
function myFunction() {
var js = " \
<script> \
window.open('https://stackoverflow.com/', '_blank', 'width=800, height=600'); \
window.open('https://www.wikipedia.org/', '_blank', 'width=800, height=600'); \
google.script.host.close(); \
</script> \
";
var html = HtmlService.createHtmlOutput(js)
.setHeight(10)
.setWidth(100);
SpreadsheetApp.getUi().showModalDialog(html, 'Now loading.');
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)