We help IT Professionals succeed at work.

Kill Image Request taking too long using JS?

1 Endorsement
Last Modified: 2018-09-20
Is there a way to monitor and then kill a server request for an image (preferably in JavaScript) if it is taking too long? The image comes from a 3rd party server so I'd have to kill it on the request side. I'm asking due to us firing 3rd party marketing pixels on our web app. Sometimes they take extreme amounts of time to respond.
Watch Question

David FavorFractional CTO
Distinguished Expert 2019

Maybe say what you're trying to accomplish or problem to correct.

1) If pixel takes to long, when visitor leaves site, request will die, so no action is required.

2) If pixel is interferring with page render, move the pixel embed code to your document footer.

3) If document footer relocation fails, then wrap pixel in Javascript, to request only begins after page is rendered.


There isn't any impact to our site other than the reports that are generated on page load times to our execs. Yes, I've explained DOM content loaded etc. but it doesn't matter.
Distinguished Expert 2019
This one is on us!
(Get your first solution completely free - no credit card required)
David FavorFractional CTO
Distinguished Expert 2019

Well... If it has no impact... ignore it...

Or, if you prefer getting this... "off your reports"... then use the #3 option above, so have some Javascript fire on "Document Ready", to fetch the pixel in background.


One issue is I don't create the calls or have control over the format/ structure. The calls are automatically generated by our analytics code (Adobe). The image requests are for transparent 2 x 2 px. gifs. They use the trojan horse (beacon technology) approach (query string on img request has the info attached using a query string.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.