I'm trying to open a site in a new tab in my browser using Google Script. I found the following script at https://gist.github.com/rheajt/84d906298dd4e6d6f06a9132d386199b :
function openTab() {
var selection = SpreadsheetApp.getActiveSheet().getActiveCell().getValue();
var html = "<script>window.open('" + selection + "');google.script.host.close();</script>";
var userInterface = HtmlService.createHtmlOutput(html);
SpreadsheetApp.getUi().showModalDialog(userInterface, 'Open Tab');
}
The script opens a new tab, but unfortunately it the URL reads like this: https://n-54i7um4megvoh6ujyzbx4xatgjsopusyvyccwrq-0lu-script.googleusercontent.com/www.domainname.com
I'm not smart enough to understand what's wrong – please help