Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0613· openaiHugging Face Suzhen/CodeChat

how to block http requests using google dev tools console? i need a command

  1. User

    how to block http requests using google dev tools console? i need a command

  2. Assistant

    To block HTTP requests using Google DevTools console, you can use the fetch function to intercept and interrupt the requests. Here's an example command:

    fetch('http://example.com/api/endpoint-to-block', { method: 'GET',​​​​​ headers: new Headers()​​​​​,​​​​​ redirect: 'follow'​​​​​ })
      .then(() => console.log('Blocked the request!'))
      .catch(() => console.log('Failed to block the request!'));
    

    Make sure to replace http://example.com/api/endpoint-to-block with the actual URL you want to block.