The code.gs has the following code.
function doGet() {
var output = HtmlService.createHtmlOutputFromFile('userendhtml');
output.addMetaTag('viewport', 'width=device-width, initial-scale=1');
return output;
}
The userendhtml has the following code.
<a href="https://drive.google.com/file/d/xxxxxxxx/view?usp=sharing">Lecture Notes</a>
The Google Drive Link refers to pdf file shared publicly. When user runs the script, The output is correct. However when he clicks on the link, he get the error that drive refused to connect. This works when I make the link with target =_"blank". I want to open pdf in same tab. How to solve this error? Can it be restructured in a way that back (browser back) will also work?
It is a known issue in Apps Script and likely happens when you are logged into multiple Google accounts.
Try the same app inside Chrome's incognito mode or log out of all other Google accounts and only log into the main Google account.