
|
View Full Version : Problem only presenting in FireFox
Rman2003 09-09-2006, 01:23 AM Ok, here's the background...
I have a page, within an application with a link. When clicking the link, the page reloads adding a variable to the url and an email is sent.
When clicking the link in FireFox, the email is sent twice, (it's acting like the page is being loaded twice).
When done in IE, or Safari, only one email is sent, indicitive of the page being loaded only once.
Has anyone ever experienced something similar to this? This doesn't seem to be a problem when using the POST'ing or GET'ing with forms, just when I use a link.
It's extremely annoying.. I spent three hours on this before I realized it wasn't my script, and was a browser issue.
Suggestions?
Thanks in advance.
Xeentech 09-09-2006, 04:32 AM This is why we have POST. You're supposted to be able to request a GET over and over without making any type of change or actioning anything. A POST is always confirmed before it reloads.
What FireFox might be doing is loading the HTTP header to see the last updated time, and when it seems its fresh makes a second request and downloads the whole file. That would show up as two requests on your CGI.
You should use a POST when ever possiable with CGIs that action things.
Rman2003 09-09-2006, 01:18 PM Using post did correct the problem, but it seems like that was a bandaid rather than a solution.
The page is PHP, and calling itself, not cgi.
Example: youre on user.php and linking to user.php?resend=1
in user.php there is a section that is roughly :
if ($resend =='1') { // do something;}
I've never run into this before, but I suppose you're right about using POST when calling a script that performs an action.
Is this a bug in FF, or is calling the page twice the correct functionality, and IE & Safari are both lacking?
I would think something like this would be more of an issue but I didn't really find any useful information on the subject when googling.
Xeentech 09-09-2006, 01:32 PM When I say 'CGI' I don't mean a server side executable binary. CGI is Common Gateway Interface..
CGI is the idea of putting ?param=value&foo=bar. CGI is also POST. PHP is a language, as is Perl, they can both be used as 'CGI applications'.
GET URLs should be able to be gotten over and over without any ill effect, POST PUT DELETE and all others don't have this trait.
Not a bug in FireFox, the only reason this is showing up is the fact that it is implementing the HTTP/1.1 spec differently.
Jatinder 09-09-2006, 01:40 PM I have never come accross a this situation, and I use PHP while coding all the time.
Rman2003, try starting the firefox in safe mode (with plugins disabled) and then test your script. Maybe its because of some plugin you installed.
Xeentech 09-09-2006, 01:44 PM If you have control of a router upstream of your PC you might find it usefull to use Ethernet (forgot its new name) or something like tcpcap so see what HTTP requests FireFox is making.
I'm certin it will be a header check. I've seen this issue before with CGIs clients have compplained about being whach.
Rman2003 09-09-2006, 02:11 PM Safe Mode didn't make a difference, and unfortunately, I don't have access to an upstream router.
It's not really THAT big of a deal, just an annoyance, and I was curious if anyone else had run into it. I'm used to having problems out of IE, not FF. That's why I assumed it was something in my code. Which, I suppose it is if you refer to the choice of using GET over POST.. but that can always be changed.
Thanks for the comments.
azizny 09-09-2006, 04:00 PM Nope
I think its something with your firefox
I have some scripts which delete items if id is passed by URL and the script works fine in FF (prints ok if deleted, else not found).
Peace,
brianoz 09-09-2006, 08:04 PM If you have control of a router upstream of your PC you might find it usefull to use Ethernet (forgot its new name) Ethereal ... a network packet capture/trace utility (great stuff - and free!) - www.ethereal.com.
Xeentech 09-10-2006, 07:53 AM Aparently Ethereal is to change its name to Wireshark.. thats what I mean't by new name..
NewsForge article: http://trends.newsforge.com/article.pl?sid=06/06/09/1349255&tid=138&tid=92
The newest version is 0.99.3, from http://www.wireshark.org/
ethereal's latest seems to be 0.99.0..
Saeven 09-12-2006, 01:42 AM Hook this up to your Firefox:
http://livehttpheaders.mozdev.org/
See if your browser is making two requests. You might have an extension installed which is the culprit as well, have you tried disabling extensions?
discobean 09-12-2006, 02:43 AM I suggest after you send the email (in the user.php?send=1 page) that you send a header to a URL without the send=1 variable as such:
header("Location: user.php");
exit();
This way, after the script runs the browser is forwarded. A refresh, or a back button click won't go back to the user.php?user=1 page anymore, and you won't get a second email.
This is generally good practice anyway. Although I have heard about some issues with Location http headers and IIS, so be wary.
If this still dosn't fix it, then I would do like the other guys said, livehttpheaders to check why.
|