add check for content type before injecting window.onerror