我已成功編寫腳本並將其嵌入到我的Google網站中。該腳本在Chrome和Safari中運行良好,但在IE中收到「此內容無法在框架中顯示」錯誤,即使我已經使用Google腳本小工具的Google說明添加了該腳本。看看我的代碼,是否有這個代碼的特定部分導致IE的安全問題,並拒絕顯示它?該代碼將電子表格加載到帶有製表符的圖表中(這是一個很大的電子表格,因此我將其細分爲製表符),然後用戶可以根據幾個不同的字段進行過濾。有沒有解決這個問題的方法?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;
}
嗨@ EricLaw,感謝您的信息。我附上了一個截圖:http://imagesup.net/?di=1513770228488。我已經做了一些更多的研究,並且注意到,默認情況下,插入> Apps腳本將Apps腳本放在iframe中(通過單擊查看源代碼可以在網站上看到此內容),所以沒有辦法不使用它在iframe中。現在我已經把GAS加載到了一個新的頁面中,在IE中顯示,這是一個可行的解決方法,除了你失去了標題和導航,所以真的不理想。 – user2699724
是的,這是X-Frame-Options塊頁面。您可以使用Fiddler或其他網絡調試器查看發送的確切HTTP標頭值。 – EricLaw