Run google web apps script alright in dev mode but

2019-09-16 06:38发布

I have a script project called displayhtmlfromquerystring,

the script file is

function doGet(e){
  var html;
  if(e.parameter.html)
    html=e.parameter.html;

  else
    html="Error no html";

    return HtmlService.createHtmlOutput(html+"<hr/>");
}

I have deployed it as web apps, google gave me two links, one ends with "dev" and one ends with "exec".

When run script with dev link, it is alright but when run with exec link the page displayed the only word "undefined", I got stuck, could any one tell me why?

Link of my script app "https://script.google.com/macros/s/AKfycbyinAHBmjVgKDinY-bCcwQ4bgy87KuibiflG1158qRkBJSSXeMk/exec"

2条回答
smile是对你的礼貌
2楼-- · 2019-09-16 07:36

It's working for me when I use your code:

function doGet(e) { // main function
    var html;
  if(e.parameter.html)
    html=e.parameter.html;

  else
    html="Error no html";
    return HtmlService.createHtmlOutput(html+"<hr/>");
}

enter image description here

查看更多
兄弟一词,经得起流年.
3楼-- · 2019-09-16 07:37

The /dev links only work when you are logged in your Google account.

When making any changes to your code, you should go to Publish > Deploy As Web App, select a new version and click Update.

Now the latest changes would be available on the /exec page as well.

查看更多
登录 后发表回答