Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firefox makes two HTTP requests [closed]

Tags:

firefox

Ok this is weird.

If I make a request to a page, where it's text/html, firefox makes one request.

If I make a request to a page, where it's application/xml, firefox makes two requests.

In IE, Google Chrome, it one makes one in both cases.

Any ideas why the two requests, and how I can force just the one?

like image 629
Dave Quested Avatar asked Dec 14 '09 22:12

Dave Quested


2 Answers

I've had a similar issue if the encoding of the page didn't match the <meta> tag. If the page was encoded using default windows encoding, but the meta tag specified UTF-8, then firefox would stop downloading once it reached a non-ascii character (e.g. æ,ø or å) and it would redownload the page from the beginning. This would mess up view counts and lots of other logic since the server side script would run twice.

It might be that if you do not start your page with <?xml ?>, but claim that it is, then Firefox will redownload the page again as html (text/html) and process it as html.

like image 164
Marius Avatar answered Sep 24 '22 20:09

Marius


Just to add another possibility...

If the html code contains an empty img src attribute, then this causes a 2 http request in both Firefox and Chrome. Currently, those are the ones that follow the standard to the letter, which states that an empty URI reference refers to the absolute base URI.

like image 31
pns Avatar answered Sep 24 '22 20:09

pns