Some websites require you to confirm before exit or load another page. I'm trying to get rid of these type of confirmation dialogs like these :
So here is what i'm doing :
Code: Select all
procedure TChromium1.onBeforeUnloadDialog(Sender: TObject; const browser: ICefBrowser; const messageText: ustring;
isReload: Boolean; const callback: ICefJsDialogCallback; out Result: Boolean);
begin
Result := true;
end;
You can simulate this on any Facebook page :
1 - Navigate to www.Facebook.com and login
2 - Simulate a post on your own page , just write something but do not click on Publish.
3 - Now try to navigate to another page ; Facebook will show a confirmation message and this is the kind i want to supress ; i want the user to be able to naviage wherever he wants without any kind of confirmation.
I also tried to run this code after the page loads :
Code: Select all
window.onbeforeunload = null;