IE中的Apps脚本帧错误

时间:2013-08-20 11:57:46

标签: internet-explorer iframe google-apps-script

我已成功编写脚本并将其嵌入到我的Google网站中。该脚本在Chrome和Safari中运行良好,但我收到IE中的“此内容无法在框架中显示”错误,即使我已使用Google脚本小工具的Google说明添加了该脚本。看看我的代码,是否有这个代码的特定部分导致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;

}

2 个答案:

答案 0 :(得分:0)

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

此标头用于对抗ClickJacking攻击。

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

答案 1 :(得分:0)

在谷歌网站上的一个实验性脚本小工具在Chrome上工作正常,在不同的计算机上运行IE11时,给了我框架错误消息。 然后我意识到我在该计算机上使用了不同的谷歌帐户登录,并且我发布了脚本小工具,只有我和#34;。 我将此设置更改为"任何人"在"部署为网络应用程序"发布菜单。 现在,我的脚本在IE11中运行正常,没有帧错误。