Medium Feed


Saturday, December 12, 2020

Custom HTTP interceptor hook to Intercept Iframe Window HTTP requests from Parent Window in Angular

 As we all know, angular provides a default HTTP Interceptor as part of angular HTTP module. We can use this interceptor to intercept the HTTP requests. But this has a limitation of intercepting HTTP calls only from the current window object. 

Recently I had a requirement to intercept the HTTP requests triggered from Iframe window object and add the intercept values from parent object. We tried with default angular HTTP interceptor object, as I initially expected it did not work. Because the default HTTP interceptor does not provide provision to intercept the iframe window object. 

Hence, I've written a quick hook using JavaScript which will intercept all the HTTPRequests triggered from the Iframe object.  

This will be a hook within the XMLHTTPRequest open object and the hook will stay permanent in the iframe object until the iframe window object itself completely destroyed. 

Here is the custom hook you can add in your parent window object. You just have to inject the interceptor in the iframe load event.


  1. Hello.
    You created an outstanding code.I'm glad to finaly find this code,because I was searching ideas like the code for long time.
    I have a question about the code. Can I ask you?
    Isn't the code subject to restrictions of the same domain policy?

  2. Ordering & Delivery.Each set is handmade to order and can take weeks to finish. Due to the precision nature of the wheel, Cammegh's specialist transport staff will contact you publish buy to arrange delivery and ensure transport prices. The luxury set is housed in two glossy black presentation cases, each with uniquely numbered 007 metallic plaques. Relationship Roulette Machine™️ The first determination free way to swipe across your relationship apps. This modern gadget slides over your smartphone and constantly flashes the pink and Betman green lights in a randomized sample assist you|that will assist you|that can assist you} discover your next life companion. No matter what your relationship app of alternative is - leave love into fate’s palms as you observe the guided lights to simply accept|to simply accept} or reject each particular person you come across, till you lastly come across the perfect match.