JS Learner
JS Learner

Reputation: 25

google apps script change Title

In Google Apps Script - I set the title using the doGet as below.

Google Apps script .gs

function doGet(e) {
  return HtmlService.createHtmlOutputFromFile('BFform.html')
 .setTitle("This is MYTITLE"); 

}

function ChangeTitle() {
  var Changed =  HtmlService.createHtmlOutputFromFile('BFform.html');
Changed.setTitle("New Title");  
 }

I now need to change the title when a button is clicked

On the HTML file on click of a button I have as below

 function CallChangeTitle(){
  google.script.run.ChangeTitle();
 }

However the Title is not changing

Upvotes: 2

Views: 3392

Answers (2)

Juan Berdah
Juan Berdah

Reputation: 31

You can do it using the method setTitle(String). The linked documentation describes its usage.

Upvotes: 3

Amit Agarwal
Amit Agarwal

Reputation: 11278

The Apps Script web app is rendered inside an IFRAME. For security reasons, you cannot access or change the title of the parent window from an iframe which is located on another server.

Upvotes: -1

Related Questions