This will create a window on its own and embed browser in it.
When using "window.open" the window is created implicitilly
by CEF. You can intercept such popup creation using the
OnBeforePopup callback in LifespanHandler. You can return
True in OnBeforePopup and create popup window on your own
using the CreateAnotherBrowser function.
external.CreateAnotherBrowser()
Notes: On Linux it seems that OnLoadError with errorCode = ERR_ABORTED
is called even for successful downloads, you can ignore this behavior.
The proper console messages about successful/aborted download originate
from C++ Browser process code, these are:
Browser: About to download file: ubuntu-wallpapers2.zip
Browser: Download completed, saved to: /Downloads/ubuntu-wallpapers2.zip
If download was aborted the messages will be:
Browser: About to download file: ubuntu-wallpapers2.zip
Browser: Download was cancelled
Additionally on Linux there are more errors reported by Chromium
about org.gnome.SessionManager.inhibit. These can be safely ignored as well.
A download handler with callbacks like `OnBeforeDownload` and
`OnDownloadUpdated` may be exposed to CEF Python in the future.
Press F5 to reload page and ignore cache.
Press Esc during webpage loading to abort.
Also, when Esc is pressed OnLoadError may get called. See how abort
of page loading or file download is handled:
jsBindings.SetProperty("pyProperty", "This was set in Python")
jsBindings.SetProperty("pyConfig", ["This was set in Python",
{"name": "Nested dictionary", "isNested": True},
[1,"2", None]])
Press F5 to reload the page.
On Linux it is required to click anywhere in the window first
so that keyboard focus is set. See Issue 77 in the CEF Python
Issue Tracker.
Popup browsers created javascript's window.open share
the same renderer process and request context. If you want
to have separate cookie managers for popups created using
window.open then you have to implement the
LifespanHandler.`OnBeforePopup` callback. Return True in that
callback to cancel popup creation and instead create the
window on your own and embed browser in it. The CreateAnotherBrowser()
function from the wxpython example does that.