2

When I click on a "Load more" button in the website, there are new variations loaded. You can spot them on the "Network" tab in the inspector of google chrome

See here the output when I clicked, the new color options are shown

Once a request with a status are logged in this "network" tab. Is it possible to add a listener or some sort to a specific log of this, for example: once the "Rectangle-Copy-14.png" is logged, call a function.

Asking this for this project but also for in the future, I don't use a lot of javascript in this project but for in the future I will.

2
  • Can you change the html element that loads the png image? If so, does this answer your question? stackoverflow.com/questions/280049/… Commented Sep 15, 2022 at 8:12
  • Please provide enough code so others can better understand or reproduce the problem. Commented Sep 15, 2022 at 13:44

1 Answer 1

3

If the browser supports it, you could use the resource timing API. I would assume you would have to keep listening to the resources of performance, like :

 performance.getEntriesByType("resource")

Then you can filter this entries by name or type :

resources.filter(resource => resource.name == "Rectangle-Copy-14.png")

If the filter returns a PerformanceResourceTiming with a responseEnd you can then establish that the resource has been loaded and do whatever after.

Sign up to request clarification or add additional context in comments.

1 Comment

Hello @eloimondelo, Can you provide any hints on how to access the response data of the resources?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.