Can Bootstrap.js be used in GAS (Google Apps Script)?

前端 未结 2 908
有刺的猬
有刺的猬 2021-02-09 06:56

In GAS, I want to place HTML content inside tabs like what is described here.

I built a working prototype in this jsFiddle. (Since the code is HTML, it does not rende

2条回答
  •  醉梦人生
    2021-02-09 07:25

    Finally had time to fiddle with your code, after some time in the page you get a error from the server stating that the file "bootstrap.min" was denied. So I created a file "bootstrap.html", copied all of its content to this file, surrounded with script tags, included it in the HTML and voilá, it's working.

    The list of changes:

    in any code.gs

    function include(filename) {
      return HtmlService.createHtmlOutputFromFile(filename)
      .setSandboxMode(HtmlService.SandboxMode.IFRAME)
      .getContent();
    }
    

    in the mainPage.html

    
    

    The doGet now must use createTemplateFromFile and evaluate()

    function doGet(e) {
      return HtmlService.createTemplateFromFile('mainPage').evaluate()
          .setSandboxMode(HtmlService.SandboxMode.IFRAME);
    }
    

    And an file with all bootstrap surrounded by script tags.

提交回复
热议问题