Browsers send requests twice

Several days ago, I found that some pages of my site would be requested twice each time. I also noticed that this only happens when I am not logged in.


But since I noticed this in firebug console, I thought it maybe just a trick of firebug to show the request but not that the page is requested twice. I also thought the other request may be sent by a plugin of firefox. Then I disabled all the plugins I was using. However, it didn't make any different.


Later, I began to log all the db quries. And found that the page was actually requested twice. Then came the question -- why??? Why it's loaded twice? I wondered it either be the problem of firefox (or the plugins with it) or the problem of Zend Framework.


I updated the Zend Framework to the lastest version 1.9.3. But no lucky. So it must be the proble of firefox. And how about other browsers? I tested this on IE6/7, Opera 10, Safari, Chrome, Arora and found that only IE and Opera did not send the request twice. So now I'm sure the problem is caused by the client but not the server side.


But why do some of the browsers send twice request? Finally I tried baidu, and found it might be caused by the empty value assigned to attribute src of the <img> tag. Then I realised that when not logged in, the user's prifile icon is empty. That must be the couse of the problem! So I assigned it with an 1*1 pixel blank image. Problem solved.


Details please see the http://jrgns.net/node/11 (English) or http://hi.baidu.com/bdui/blog/item/9f6ed4af65c349cf7cd92a1f.html (Chinese).

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值