Google Script - Sidebar button keeps opening a new tab

眉间皱痕 提交于 2019-11-27 05:39:49

Issue:

  • <button> type, if not specified defaults to type=submit. So, The form automatically submits the data to the server. This is not preferable in a iframe.

Solution:

  • Explicitly specify button type as button. <button type='button'>
  • Use event.preventDefault() to prevent automatic form submission.

References:

When I saw your issue, I thought that this is due to <form>. So I proposed the following modifications.

  1. Modify <form> to <form onsubmit="event.preventDefault()">.

  2. Modify <base target="_top"> to <base target="_self">.

  3. Remove <base target="_top">.

Note:

References:

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!