Skip to content

Instantly share code, notes, and snippets.

@xsephiroth
Created September 24, 2017 06:51
Show Gist options
  • Save xsephiroth/e25da858b349aaa68de92bc011bc7a33 to your computer and use it in GitHub Desktop.
Save xsephiroth/e25da858b349aaa68de92bc011bc7a33 to your computer and use it in GitHub Desktop.
electron x-frame-options
const {session} = require('electron')
const {ipcMain} = require('electron')
ipcMain.on('disable-x-frame', (event, arg) => {
session.fromPartition(arg.partition).webRequest.onHeadersReceived({}, (d, c) => {
if(d.responseHeaders['x-frame-options'] || d.responseHeaders['X-Frame-Options']){
delete d.responseHeaders['x-frame-options'];
delete d.responseHeaders['X-Frame-Options'];
}
c({cancel: false, responseHeaders: d.responseHeaders, statusLine: d.statusLine});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment