Google脚本应用编码返回html输出

时间:2018-06-26 22:39:56

标签: javascript google-apps-script

我正在创建一个Google脚本,我想从doPost之后返​​回HTML页面。

 function doPost(e) {

  var HTML = HtmlService.createHtmlOutput('<h1>testing 123</h1>')

  return HTML
}

如果我进入邮递员并对此脚本进行POST,我将得到以下HTML页面-它似乎正在对我的HTML进行编码并且无法正确显示。有什么建议吗?

<!doctype html>
<html>
   <head>
      <meta name="chromevox" content-script="no">
      <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
      <link rel="stylesheet" href="/static/macros/client/css/2884109797-mae_html_css_ltr.css">
      <script type="text/javascript" src="/static/macros/client/js/512339506-warden_bin_i18n_warden.js"></script>
   </head>
   <body role="main">
      <table id="warning-bar-table" class="full_size" cellspacing="0" cellpadding="0">
         <tr>
            <td>
               <div id="warning" class="warning-bar"></div>
            </td>
         </tr>
         <tr>
            <td style="height: 100%"><iframe id="sandboxFrame" allow="accelerometer *; ambient-light-sensor *; autoplay *; camera *; encrypted-media *; fullscreen *; geolocation *; gyroscope *; magnetometer *; microphone *; midi *; payment *; picture-in-picture *; speaker *; usb *; vibrate *; vr *" sandbox="allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top-navigation"></iframe></td>
         </tr>
      </table>
      <script type="text/javascript">
         (function() {
         var el = document.getElementById('sandboxFrame');
         el.onload = function() {
         goog.script.init("\x7b\x22functionNames\x22:\x5b\x22doPost\x22\x5d,\x22sandboxMode\x22:\x22IFRAME_SANDBOX\x22,\x22callbackTimeout\x22:390000,\x22deploymentId\x22:\x22AKfycbwDJCSuAdgx2GPqFaLZwao_jZ1kZaXt1nlj3N1nXvs4uPqAAdIA\x22,\x22eei\x22:\x22\x22,\x22sandboxHost\x22:\x22https:\/\/n-vtyu6u2xuzf53tasl5gta27tdrzpfibnjd2py4a-0lu-script.googleusercontent.com\x22,\x22clientSideProperties\x22:\x7b\x22google.script.sandbox.mode\x22:\x22IFRAME_SANDBOX\x22,\x22google.script.host.origin\x22:\x22https:\/\/docs.google.com\x22\x7d,\x22actionPrefix\x22:\x22\/macros\/s\/AKfycbwDJCSuAdgx2GPqFaLZwao_jZ1kZaXt1nlj3N1nXvs4uPqAAdIA\x22,\x22userHtml\x22:\x22\\u003ch1\\u003etesting 123\\u003c\\\/h1\\u003e\x22,\x22ncc\x22:\x22\x7b\\\x22awhs\\\x22:true\x7d\x22\x7d", "", undefined, true ,  false , false  , "false", "https:\/\/n-vtyu6u2xuzf53tasl5gta27tdrzpfibnjd2py4a-0lu-script.googleusercontent.com");}
         el.src = 'https:\/\/n-vtyu6u2xuzf53tasl5gta27tdrzpfibnjd2py4a-0lu-script.googleusercontent.com\/userCodeAppPanel';
         }());
      </script>
   </body>
</html>

0 个答案:

没有答案