0

我已经成功编写了一个脚本并将其嵌入到我的 Google 站点中。该脚本在 Chrome 和 Safari 中运行良好,但我在 IE 中收到“此内容无法在框架中显示”错误,即使我已使用 Google 的说明和 Apps Script Gadget 添加了该脚本。查看我的代码,该代码是否有特定部分导致 IE 出现安全问题并拒绝显示它?该代码将电子表格加载到带有选项卡的图表中(这是一个很大的电子表格,因此我将其细分为选项卡),然后用户可以根据几个不同的字段进行过滤。有解决方法吗?

function doGet(e) {
  var app = UiApp.createApplication();
  var ssID = '0AhiXAz5qhL4TdERkNFJndkVXd1A3T0xYdHlnMkp3U2c';
  var ss = SpreadsheetApp.openById(ssID);
  var sheet = ss.getSheets()[0];
  var dataRange = sheet.getDataRange();
  var numRows = dataRange.getNumRows();
  var numCols = dataRange.getNumColumns();
  var dataTable = sheet.getRange(1, 4, numRows, numCols - 3).getDataTable();

  // Filters
  var locationFilter = Charts.newCategoryFilter()
    .setDataTable(dataTable)
    .setFilterColumnLabel('Where was your role located?')
    .setAllowMultiple(true)
    .setSortValues(true)
    .setLabelStacking(Charts.Orientation.VERTICAL)
    .setCaption('Choose a location')
    .setSortValues(true)
    .build();
  var functionFilter = Charts.newCategoryFilter()
    .setDataTable(dataTable)
    .setFilterColumnLabel('In what function was your role?')
    .setAllowMultiple(true)
    .setSortValues(true)
    .setLabelStacking(Charts.Orientation.VERTICAL)
    .setCaption('Choose a function')
    .setSortValues(true)
    .build();
   var titleFilter = Charts.newCategoryFilter()
    .setDataTable(dataTable)
    .setFilterColumnLabel('What was the role title?')
    .setAllowMultiple(true)
    .setSortValues(true)
    .setLabelStacking(Charts.Orientation.VERTICAL)
    .setCaption('Choose a title')
    .setSortValues(true)
    .build();
  var numberFilter = Charts.newCategoryFilter()
    .setDataTable(dataTable)
    .setFilterColumnLabel('Which placement was the role?')
    .setAllowMultiple(true)
    .setSortValues(true)
    .setLabelStacking(Charts.Orientation.VERTICAL)
    .setCaption('Choose a placement number')
    .setSortValues(true)
    .build();


  // Build individual tab charts
  // Tab 1: Role Specific
  var dataViewDef1 = Charts.newDataViewDefinition().setColumns([0, 1, 2, 3, 4, 5, 6, 7, 8]);
  var chart1 = Charts.newTableChart().setDataTable(dataTable).setOption('width', '100%').setOption('height', '100%').setDataViewDefinition(dataViewDef1).build();

  // Tab 2: Training
  var dataViewDef2 = Charts.newDataViewDefinition().setColumns([0, 1, 2, 3, 9, 10, 11]);
  var chart2 = Charts.newTableChart().setDataTable(dataTable).setOption('width', '100%').setOption('height', '100%').setDataViewDefinition(dataViewDef2).build();

  // Tab 3: Line Manager
  var dataViewDef3 = Charts.newDataViewDefinition().setColumns([0, 1, 2, 3, 12, 13]);
  var chart3 = Charts.newTableChart().setDataTable(dataTable).setOption('width', '100%').setOption('height', '100%').setDataViewDefinition(dataViewDef3).build();

  // Tab 4: Development Tools
  var dataViewDef4 = Charts.newDataViewDefinition().setColumns([0, 1, 2, 3, 14, 15]);
  var chart4 = Charts.newTableChart().setDataTable(dataTable).setOption('width', '100%').setOption('height', '100%').setDataViewDefinition(dataViewDef4).build();

  // Tab 5: Culture, Visas, and Moves
  var dataViewDef5 = Charts.newDataViewDefinition().setColumns([0, 1, 2, 3, 16, 17]);
  var chart5 = Charts.newTableChart().setDataTable(dataTable).setOption('width', '100%').setOption('height', '100%').setDataViewDefinition(dataViewDef5).build();

  // Create GUI
  var tabPanel = app.createTabPanel();
  var vpanel = app.createVerticalPanel().setSpacing(10);
  var scroll = app.createScrollPanel().setId('scroll').setSize('100%', '100%');

  tabPanel.add(chart1, 'Role Specific').add(chart2, 'Training').add(chart3, 'Line Manager').add(chart4, 'Development').add(chart5, 'Culture');
  tabPanel.selectTab(0);
  vpanel.add(locationFilter).add(functionFilter).add(titleFilter).add(numberFilter).add(tabPanel);

  var dashboard = Charts.newDashboardPanel().setDataTable(dataTable).bind([locationFilter, functionFilter, titleFilter, numberFilter], [chart1, chart2, chart3, chart4, chart5]).build();

  dashboard.add(vpanel);

  app.add(dashboard);

  return app;

}
4

2 回答 2

0

屏幕截图可能会有所帮助。但是根据相关错误消息的描述,当服务器发送X-FRAME-OPTIONS: DENYorX-FRAME-OPTIONS: SameOrigin标头以防止成帧时,您会看到这一点。

此标头用于对抗 ClickJacking 攻击。

有关详细信息,请参阅http://blogs.msdn.com/b/ieinternals/archive/2010/03/30/combating-clickjacking-with-x-frame-options.aspx

于 2013-08-20T17:54:07.157 回答
0

google-sites 中一个在 Chrome 上运行良好的实验性脚本小工具在不同计算机上的 IE11 上运行时给了我帧错误消息。然后我意识到我在该计算机上使用不同的谷歌帐户登录,并且我发布了“只有我”的脚本小工具。我在“部署为 Web 应用程序”发布菜单中将此设置更改为“任何人”。 现在,我的脚本在 IE11 中运行良好,没有帧错误。

于 2017-01-03T22:42:07.010 回答