Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What to do with chrome sending extra requests?

Google chrome sends multiple requests to fetch a page, and that's -apparently- not a bug, but a feature. And we as developers just have to deal with it.

As far as I could dig out in five minutes, chrome does that just to make the surfing faster, so if one connection gets lost, the second will take over.

I guess if the website is well developed, then it's functionality won't break by this, because multiple requests are just not new.

But I'm just not sure if I have accounted for all the situations this feature can produce.

Would there be any special situations? Any best practices to deal with them?

Update 1: Now I see why my bank's page throws an error when I open the page with chrome! It says: "Only one window of the browser should be open." That's their solution to security threats?!!

like image 747
Cg Alive Avatar asked Dec 16 '10 12:12

Cg Alive


People also ask

How do I stop Google Chrome from sending data?

To turn it off, you need to navigate to the menu button at the top right of the browser on your computer – it looks like three vertical dots – and then click Settings. Then, if you don't want any of your data to sync across Chrome at all, just click the Turn off button', next to your name and email address.

Does Chrome collect your data?

The private data Chrome collects includes your location, search and browsing history, user identifiers and product interaction data for “personalisation” purposes. A lot of this data is then sent directly to Google. Even if you're browsing in private mode, Google can see everything you do online.

How do I see browser requests?

To view the request or response HTTP headers in Google Chrome, take the following steps : In Chrome, visit a URL, right click , select Inspect to open the developer tools. Select Network tab. Reload the page, select any HTTP request on the left panel, and the HTTP headers will be displayed on the right panel.


2 Answers

Your best bet is to follow standard web development best practises: don't change application state as a result of a GET call.

If you're worried I recommend updating your data layer unit tests for GET calls to be duplicated & ensure they return the same data.

(I'm not seeing this behaviour with Chrome 8.0.552.224, by the way, is very new?)

like image 166
Peter Avatar answered Sep 29 '22 23:09

Peter


I saw the subjected behavior while writing a server application and found that earlier answers are probably not true.

Chrome distributes a single request into multiple http ones to fetch resources in parallel. In this case, it is an image which it fetches as a separate http get.

I have attached screen shot of packet capture through wireshark.

It is for a simple get request to port 8080 for which the server returns a hello message.

Chrome sends the second get request for obtaining favorite icon which you see on top of every tab opened. It is NOT a second get to cater time out or any such thing.

It should be considered another element that differs across browsers. However, doing things in multiple http requests in parallel is kind of a standard thing in browsers as of 2018.

Here is a reference question that i found latter

Chrome sends two requests SO

chrome requests favorite icon

Chrome issue on google code

like image 35
fkl Avatar answered Sep 29 '22 23:09

fkl