I am using Google Apps Script with Google Drive, and I am a very beginner in this matter. Now, I would like to open a given Url in the same window. In standard JavaScript, there would be the 'open' method:
var windowObjectReference = window.open(strUrl, strWindowName[, strWindowFeatures]);
Probably, HtmlService would be the best solution with Google Apps Script. The following code should open the Google-site in the same window:
function doGet() {
return HtmlService.createHtmlOutput(
"<form action='http://www.google.com' method='get' id='foo'></form>" +
"<script>document.getElementById('foo').submit();</script>");
}
I opened Google Drive and created a new script. I typed in the above content in the editor of Google Docs Script. But when I am running this function from there, nothing at all will happen. Why so? Could you correct me? And what would be the code for opening Google in a new window?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…