Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent AJAX requests in Chrome/Firefox after initial load

I am trying to debug a page in Chrome. Every few seconds the page issues AJAX requests that update elements on the page. Is there a DevTools option to stop these page requests? It makes debugging HTML/CSS difficult since the DOM is reset.

like image 608
jumbopap Avatar asked Feb 11 '14 17:02

jumbopap


People also ask

How do I stop HTTP requests in Chrome?

Request blocking in Chrome or Firefox​Open the devtools panel. Locate the request you wish to block. Right-click on the request. Select one of the options, "Block request URL" or "Block request Domain" - domain option only available in Chrome.

Does Google Chrome support AJAX?

Ajax is supported in all modern browsers. We suggest using the following browsers: Google Chrome. Mozilla Firefox.


3 Answers

It's a little harsh, but you could override the XMLHttpRequest's call method, then it won't do anything

XMLHttpRequest.prototype.call = function () {};

Type that statement into the console panel of the page your debugging. A page refresh will reset the native functionality.

like image 94
PatAtCP Avatar answered Oct 05 '22 06:10

PatAtCP


Open Chrome DevTools. Make a breakpoint in the line that you think it will be run before AJAX requests. Javascript will stop running until you press 'resume' button. Ps: you will see the page's original style. But it's still hard to change html or css in console. So this may not be the best answer!

like image 29
thanhtung9630 Avatar answered Oct 05 '22 06:10

thanhtung9630


On dev tools:

Three vertical dots icon >> Network conditions >> Offline present

enter image description here

enter image description here

like image 21
David Lampon Avatar answered Oct 05 '22 08:10

David Lampon