diff --git a/atom/browser/lib/guest-view-manager.coffee b/atom/browser/lib/guest-view-manager.coffee
index 1c05b65b2dc0..455e969812f7 100644
--- a/atom/browser/lib/guest-view-manager.coffee
+++ b/atom/browser/lib/guest-view-manager.coffee
@@ -84,6 +84,8 @@ createGuest = (embedder, params) ->
if params.allowtransparency?
@setAllowTransparency params.allowtransparency
+ guest.allowPopups = params.allowpopups
+
# Dispatch events to embedder.
for event in supportedWebViewEvents
do (event) ->
diff --git a/atom/browser/lib/guest-window-manager.coffee b/atom/browser/lib/guest-window-manager.coffee
index 861b0d10aa31..add366eca812 100644
--- a/atom/browser/lib/guest-window-manager.coffee
+++ b/atom/browser/lib/guest-window-manager.coffee
@@ -41,7 +41,7 @@ createGuest = (embedder, url, frameName, options) ->
ipc.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPEN', (event, args...) ->
[url, frameName, options] = args
event.sender.emit 'new-window', event, url, frameName, 'new-window'
- if event.sender.isGuest() or event.defaultPrevented
+ if (event.sender.isGuest() and not event.sender.allowPopups) or event.defaultPrevented
event.returnValue = null
else
event.returnValue = createGuest event.sender, args...
diff --git a/atom/renderer/lib/override.coffee b/atom/renderer/lib/override.coffee
index 6e6164a8f264..5cffdd486d9c 100644
--- a/atom/renderer/lib/override.coffee
+++ b/atom/renderer/lib/override.coffee
@@ -70,7 +70,6 @@ window.open = (url, frameName='', features='') ->
if guestId
new BrowserWindowProxy(guestId)
else
- console.error 'It is not allowed to open new window from this WebContents'
null
# Use the dialog API to implement alert().
diff --git a/atom/renderer/lib/web-view/web-view-attributes.coffee b/atom/renderer/lib/web-view/web-view-attributes.coffee
index acca826a9e3d..e980e6c96bfc 100644
--- a/atom/renderer/lib/web-view/web-view-attributes.coffee
+++ b/atom/renderer/lib/web-view/web-view-attributes.coffee
@@ -216,6 +216,7 @@ WebViewImpl::setupWebViewAttributes = ->
@attributes[webViewConstants.ATTRIBUTE_NODEINTEGRATION] = new BooleanAttribute(webViewConstants.ATTRIBUTE_NODEINTEGRATION, this)
@attributes[webViewConstants.ATTRIBUTE_PLUGINS] = new BooleanAttribute(webViewConstants.ATTRIBUTE_PLUGINS, this)
@attributes[webViewConstants.ATTRIBUTE_DISABLEWEBSECURITY] = new BooleanAttribute(webViewConstants.ATTRIBUTE_DISABLEWEBSECURITY, this)
+ @attributes[webViewConstants.ATTRIBUTE_ALLOWPOPUPS] = new BooleanAttribute(webViewConstants.ATTRIBUTE_ALLOWPOPUPS, this)
@attributes[webViewConstants.ATTRIBUTE_PRELOAD] = new PreloadAttribute(this)
autosizeAttributes = [
diff --git a/atom/renderer/lib/web-view/web-view-constants.coffee b/atom/renderer/lib/web-view/web-view-constants.coffee
index deb678e6a1e8..bfb9376fa7ea 100644
--- a/atom/renderer/lib/web-view/web-view-constants.coffee
+++ b/atom/renderer/lib/web-view/web-view-constants.coffee
@@ -13,6 +13,7 @@ module.exports =
ATTRIBUTE_NODEINTEGRATION: 'nodeintegration'
ATTRIBUTE_PLUGINS: 'plugins'
ATTRIBUTE_DISABLEWEBSECURITY: 'disablewebsecurity'
+ ATTRIBUTE_ALLOWPOPUPS: 'allowpopups'
ATTRIBUTE_PRELOAD: 'preload'
ATTRIBUTE_USERAGENT: 'useragent'
diff --git a/docs/api/web-view-tag.md b/docs/api/web-view-tag.md
index 8eb3857ac970..7b4aa2ebf86c 100644
--- a/docs/api/web-view-tag.md
+++ b/docs/api/web-view-tag.md
@@ -149,6 +149,14 @@ This value can only be modified before the first navigation, since the session
of an active renderer process cannot change. Subsequent attempts to modify the
value will fail with a DOM exception.
+### `allowpopups`
+
+```html
+