Cancel navigation to about:blank

Do not post support requests, bug reports or feature requests. Discuss CEF here. Non-CEF related discussion goes in General Discussion!

Cancel navigation to about:blank

Postby arvelius » Thu Apr 26, 2018 7:56 am

When clicking on a link like
Code: Select all
<a href="about:blank">link</a>
the OnBeforeBrowse will not be called, so it is not possible to cancel the navigation to an empty page. This causes quite a problem for me at the moment.
Is there anyone who could propose a workaround? (The only one I can think of is disabling the navigation in JavaScript, but I don't like it much)
arvelius
Techie
 
Posts: 46
Joined: Wed Sep 17, 2014 8:37 am

Re: Cancel navigation to about:blank

Postby ndesktop » Thu Apr 26, 2018 8:12 am

OnBeforeResourceLoad with frame->IsMain(), browser|frame->GetUrl() == about:blank and returning RV_CANCEL won't help?
ndesktop
Master
 
Posts: 750
Joined: Thu Dec 03, 2015 10:10 am

Re: Cancel navigation to about:blank

Postby arvelius » Thu Apr 26, 2018 11:02 am

OnBeforeResourceLoad isn't called as well :cry:
arvelius
Techie
 
Posts: 46
Joined: Wed Sep 17, 2014 8:37 am

Re: Cancel navigation to about:blank

Postby ndesktop » Thu Apr 26, 2018 11:22 am

I'm out of ideas as well. Most likely is something from Chromium handling about:blank specifically and not triggering the calls.

Next days I will go thru a libcef debug and I hope to make time to check also this. Maybe I can come up with a "failsafe" callback to post here (unless someone will be quicker and more informed than me).
(Or you can step yourself into cefclient navigation and see if something can be used).
ndesktop
Master
 
Posts: 750
Joined: Thu Dec 03, 2015 10:10 am

Re: Cancel navigation to about:blank

Postby arvelius » Thu Apr 26, 2018 11:39 am

I looked into source codes and about:blank is a special case and a blank page is served immediatelly in DocumentLoader.cpp in maybeLoadEmpty(), so it won't get into ResourceLoader at all. I'm not an expert in this, but I would say this is a design flaw. Tried to fix (workaround) that, but it seems to be too much complicated for me :evil:
arvelius
Techie
 
Posts: 46
Joined: Wed Sep 17, 2014 8:37 am

Re: Cancel navigation to about:blank

Postby ndesktop » Thu Apr 26, 2018 3:31 pm

arvelius wrote:I looked into source codes and about:blank is a special case and a blank page is served immediatelly in DocumentLoader.cpp in maybeLoadEmpty(), so it won't get into ResourceLoader at all. I'm not an expert in this, but I would say this is a design flaw. Tried to fix (workaround) that, but it seems to be too much complicated for me :evil:

Some for of callback/delegate should be invoked I think, even if there is a custom processing. As soon as I will find some time I'll check. Maybe there is something surfacing into CEF.
ndesktop
Master
 
Posts: 750
Joined: Thu Dec 03, 2015 10:10 am


Return to CEF Discussion

Who is online

Users browsing this forum: No registered users and 20 guests