Intercept ALL XMLHttpRequests [AngularJS]

I wonder whether is possible intercept all XMLHttpRequests in angularJS?

Using this config for module in AngularJS intercept only requests called by service $http. .config(function ($httpProvider) { $httpProvider.defaults.cache = true;

var $http,
    $helpers,
    interceptor = ['$q', '$injector', '$timeout', function ($q, $injector, $timer)
    {
        var error;

        function success(response)
        {
            // get $http via $injector because of circular dependency problem
            $http = $http || $injector.get('$http');

            if ($http.pendingRequests.length < 1)
            {
                // hide spinner
            }
            return response;
        }

        function error(response)
        {
            // get $http via $injector because of circular dependency problem
            $http = $http || $injector.get('$http');
            if ($http.pendingRequests.length < 1)
            {
                // show spinner
            }
            return $q.reject(response);
        }

        return function (promise)
        {
            // show spinner

            return promise.then(success, error);
        }
    }];

    $httpProvider.responseInterceptors.push(interceptor);
});

What if we want to intercept calls from external libraries? They are not called by service $http.

Any ideas?