How to allow popups?

Having problems with building or using the JCEF Java binding? Ask your questions here.

How to allow popups?

Postby Mustermann465422 » Mon Jan 15, 2024 8:53 am

I'd like to show a popup which is produced by the following Angular/JavaScript Code.

Code: Select all
  @HostListener('window:beforeunload', ['$event'])
onBeforeUnload() {
    return window.confirm('There is the unsaved message....');
}


Right know in the moment when a normal browser shows the popup, JCEF prints to the log:

[INFO:CONSOLE(0)] "Blocked confirm('There is the unsaved message....') during beforeunload."

How can I configure JCEF to show this popup?
Mustermann465422
Newbie
 
Posts: 3
Joined: Mon Jan 15, 2024 8:43 am

Re: How to allow popups?

Postby magreenblatt » Mon Jan 15, 2024 11:03 am

The beforeunload dialog will only be shown if the frame attempting to display it has received a user gesture or user interaction. See https://chromestatus.com/feature/5082396709879808
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: How to allow popups?

Postby Mustermann465422 » Tue Jan 16, 2024 4:18 am

Thanks for the hint.

But this is not the issue. If I don't interact with the frame, this is additionally logged:
Code: Select all
[0116/101526.391:INFO:CONSOLE(0)] "Blocked attempt to show a 'beforeunload' confirmation panel for a frame that never had a user gesture since its load. https://www.chromestatus.com/feature/5082396709879808", source: (0)

But if I interact with the frame, then:
Code: Select all
[INFO:CONSOLE(0)] "Blocked confirm('There is the unsaved message....') during beforeunload."

Do you have another hint? :)
Mustermann465422
Newbie
 
Posts: 3
Joined: Mon Jan 15, 2024 8:43 am

Re: How to allow popups?

Postby Mustermann465422 » Tue Jan 16, 2024 6:32 am

Updating to the newest version of JCEF solved the issue. Sorry, beginner mistake. :oops:
Mustermann465422
Newbie
 
Posts: 3
Joined: Mon Jan 15, 2024 8:43 am


Return to JCEF Forum

Who is online

Users browsing this forum: Google [Bot] and 129 guests

cron