Skip to content

Commit

Permalink
Block to change url when isMainFrame is false.
Browse files Browse the repository at this point in the history
using isMainFrame boolean in 'did-navigate-in-page' event.
[ref](electron/electron#6810)
need to more information about isMainFrame if when is set false.

when access `google.com`, google redirect `notification.google.com/...` page.
So It will occur isMainFrame === false in params of did-navigate-in-page.
  • Loading branch information
HyunmoAhn committed Oct 13, 2018
1 parent 3b8333b commit 4e11201
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/renderer/pages/widget/components/WebWidget/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,14 @@ class WebWidget extends React.Component {
this.setState({ currentUrl: e.url });
});
webView.addEventListener('did-navigate-in-page', (e) => {
this.setState({ currentUrl: e.url });
/**
* when access `google.com`, google redirect `notification.google.com/...` page.
* So To block It.
* It will occur isMainFrame === false in params of did-navigate-in-page.
*/
if (e.isMainFrame) {
this.setState({ currentUrl: e.url });
}
});
window.addEventListener('contextmenu', () => {
widgetContextMenu(this.webViewRef.current);
Expand Down

0 comments on commit 4e11201

Please sign in to comment.