New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add did-attach-webview event #10711

Merged
merged 1 commit into from Oct 26, 2017

Conversation

Projects
None yet
2 participants
@yuya-oc
Contributor

yuya-oc commented Oct 7, 2017

The event is emitted with a webContents when a webview has been attached to an existing webContents. For example, it would be useful to handle 'will-navigate' event in the main process.

win.webContents.on('did-attach-webview', (event, webContents) => {
  webContents.on('will-navigate', (event, url) => {
    if (url !== TRUSTED_URL) {
      event.preventDeefault()
    }
  }
}

@yuya-oc yuya-oc requested review from electron/docs as code owners Oct 7, 2017

@zcbenz

zcbenz approved these changes Oct 26, 2017

Looks good to me.

@zcbenz zcbenz merged commit 4db34ff into electron:master Oct 26, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@yuya-oc yuya-oc deleted the yuya-oc:did-attach-webview branch Oct 26, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment