Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

How to get HTTP response code ?

Post Reply
thefunkyjoint
Posts: 460
Joined: Thu Aug 10, 2017 12:40 pm

How to get HTTP response code ?

Post by thefunkyjoint »

I'm having an issue where when i try to navigate to a specific page inside CEF4Delphi, the page won't open, will keep blank.

But if i navigate to the same page with Chrome, it will show a HTTP ERROR 429.

How can i know in CEF4Delphi, that a HTTP 429 is returned ? Looks like CEF4Delphi won't show the http error code, like Chrome does.
User avatar
salvadordf
Posts: 4056
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to get HTTP response code ?

Post by salvadordf »

Hi,

The TChromium.OnLoadError event should be triggered and the "errorCode" parameter should have a -429 value.

Check that the TChromium.OnRenderProcessTerminated event is not triggered. :?
thefunkyjoint
Posts: 460
Joined: Thu Aug 10, 2017 12:40 pm

Re: How to get HTTP response code ?

Post by thefunkyjoint »

I tested with this simulation url :

http://httpstat.us/429

But somehow, the onLoadError event is not triggered :roll:
Student
Posts: 72
Joined: Tue Aug 07, 2018 9:20 am

Re: How to get HTTP response code ?

Post by Student »

I also do not respond to this error in the onLoadError. But as an alternative solution, you can use the event OnLoadEnd, there is httpStatusCode and track any error code and display information to the user.
thefunkyjoint
Posts: 460
Joined: Thu Aug 10, 2017 12:40 pm

Re: How to get HTTP response code ?

Post by thefunkyjoint »

Student wrote: Sat Oct 29, 2022 10:17 pm I also do not respond to this error in the onLoadError. But as an alternative solution, you can use the event OnLoadEnd, there is httpStatusCode and track any error code and display information to the user.
Thank you, this worked ! :D
dilfich
Posts: 330
Joined: Thu Nov 30, 2017 1:17 am

Re: How to get HTTP response code ?

Post by dilfich »

Wouldn't it be more correct to check in ResourceLoadComplete, I always look at the download status of a particular link there.
Student
Posts: 72
Joined: Tue Aug 07, 2018 9:20 am

Re: How to get HTTP response code ?

Post by Student »

dilfich wrote: Fri Nov 04, 2022 6:58 am Wouldn't it be more correct to check in ResourceLoadComplete, I always look at the download status of a particular link there.
I think it depends on the need, if you want to check each resource then ResourceLoadComplete, if only loading the entire page then OnLoadEnd.
Don't forget that ResourceLoadComplete is triggered on every resource load, if you have too many resources on your site, your code will be executed often and performance will go down.
Post Reply