Im trying to show a website in electron, but it appears the error that , x-frame-option is in sameorigin, i have read a lot of code about how bypass it, but i have not idea where put it, if in the main, or in what pass, someone can help me a little here? the link is this one
Asked
Active
Viewed 2,033 times
4
-
Possible duplicate of [How to set 'X-Frame-Options' on iframe?](https://stackoverflow.com/questions/27358966/how-to-set-x-frame-options-on-iframe) – Quentin Jan 08 '19 at 13:40
1 Answers
2
Use below lines after initialized BrowserWindow instance:
win.webContents.session.webRequest.onHeadersReceived({ urls: [ "*://*/*" ] },
(d, c)=>{
if(d.responseHeaders['X-Frame-Options']){
delete d.responseHeaders['X-Frame-Options'];
} else if(d.responseHeaders['x-frame-options']) {
delete d.responseHeaders['x-frame-options'];
}
c({cancel: false, responseHeaders: d.responseHeaders});
}
);
But not recommended, just embed for your testing purpose.
dphans
- 1,207
- 14
- 19