Created
September 24, 2017 06:51
-
-
Save xsephiroth/e25da858b349aaa68de92bc011bc7a33 to your computer and use it in GitHub Desktop.
electron x-frame-options
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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