Page 1 of 1
Navigate (when click on Back button) goes to blank screen
Posted: Fri Nov 27, 2020 8:53 am
by john.augustine
Hi,
My browser data has Back button ( < ).
Now the issue is, a blank screen is displaying even though there is no previous page exist when i click on Back button.
I mean, need to stop navigating ( Back ) if there is no previous page exist.
Can you please provide your suggestion on this.
Kindly refer the attached screenshots.
Thanks & Regards,
John Augustine
Re: Navigate (when click on Back button) goes to blank screen
Posted: Fri Nov 27, 2020 1:44 pm
by salvadordf
CEF browsers load "about:blank" as the first page if you don't use the TChromium.DefaultURL property.
That's the blank screen the user sees when he/she presses the back button.
Set the TChromium.DefaultURL property to the first address you want to load before calling TChromium.CreateBrowser.
Re: Navigate (when click on Back button) goes to blank screen
Posted: Fri Nov 27, 2020 2:07 pm
by john.augustine
Thanks much for your suggestion/help.
Actually, we are using "LoadRequest" and not "LoadURL".
Kindly refer the attached screenshot.
Thanks,
John Augustine
Re: Navigate (when click on Back button) goes to blank screen
Posted: Fri Nov 27, 2020 2:29 pm
by salvadordf
Then use the TChromium.OnBeforeBrowse event to allow navigation to "about:blank" only one time.
Re: Navigate (when click on Back button) goes to blank screen
Posted: Fri Nov 27, 2020 2:42 pm
by salvadordf
I just edited the previous post with a better answer.
Re: Navigate (when click on Back button) goes to blank screen
Posted: Tue Dec 01, 2020 7:10 am
by john.augustine
Hi,
Thanks much for your suggestion!
As you mentioned, I have tried this in TChromium.OnBeforeBrowse (kindly refer the attached screenshot (Before_Browse.JPG) for code) but couldn't achieve.
fRequest browser.MainFrame.LoadRequest(fRequest); > Assigning value for fRequest is at method "Display" (kindly refer the attached screenshot (LoadRequest.JPG) for code)
Thanks & Regards,
John
Re: Navigate (when click on Back button) goes to blank screen
Posted: Wed Dec 02, 2020 7:18 am
by john.augustine
Hi,
Any help on my previous post?
Thanks & Regards,
John
Re: Navigate (when click on Back button) goes to blank screen
Posted: Wed Dec 02, 2020 10:09 am
by salvadordf
Sorry, I forgot that "about:blank" is a special case that doesn't trigger the "OnBefore..." events in CEF.
https://magpcss.org/ceforum/viewtopic.php?f=6&t=15989
https://magpcss.org/ceforum/viewtopic.php?f=10&t=15950
Try this :
- Set the TChromium.DefaultURL to a DATA URL which includes your logo or your client's logo or a blank html file. It will be loaded before your request for a few tenths of a second only.
- Add the TChromium.OnBeforeBrowse to check that the previous DATA URL can only be loaded once.
Re: Navigate (when click on Back button) goes to blank screen
Posted: Wed Dec 02, 2020 10:12 am
by john.augustine
Sure, I will try this.
Thanks Much!
Regards,
John