Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Strange IE behavior
- Pink Pig
January 26, 2009, 6:39 am
rate this thread
know about it, in case something similar happens to them.
As part of a website development, I wrote a PHP file which worked just
fine under Firefox and Opera, but dropped the session under IE. It
took me ages to track this down. Here's what happened. The URL for the
main page was set up so that if it was called without GET parameters,
it would start a new session. In the normal course of operation, the
main page gets called back with a GET parameter of the form '?
mode=something', which was used by the PHP code to determine the
context in which the page should be run. This worked fine under
Firefox etc., but failed miserably and frustratingly under IE. After
months of effort, I discovered the explanation. IE was requesting the
page twice for each call, once with the GET parameter in the URL, and
the second time without any GET parameters. The server handled each of
these requests as you might expect -- it executed the PHP code twice,
the second time without the GET parameters, which caused it to
terminate the current session. There was no evidence of the second
call anywhere on the screen -- it's entirely unclear to me what
purpose the second request might have served. Once I figured this out,
I worked around it.
So be warned. Under at least some circumstances, whenever you (or one
of your users) requests a PHP page, IE will request it twice, which at
the very least will cause a performance hit. If you're unlucky, you'll
end up tearing your hair out, as I did. This is really insidious.
I finally tracked it down by writing a log file on the server which
made no assumption about what would appear on the user's screen.
Before that, I had tried to display trace messages on the screen, but
since IE apparently threw all the text away, I never saw these
- C. (http://symcbean.blogspot.c
January 26, 2009, 9:03 am
Re: Strange IE behavior
It rather sounds like a bug in your code. What does the server's logfile
say? What do the HTTP headers (request and response) look like? Which
version of IE? Did you test other versions and other browsers?
A while ago I've seen a similar problem in another guy's code, which was
simply caused by something like <img src=""> - the empty URL caused most
browsers to immediately request the current document a second time.
Re: Strange IE behavior
That's an odd one, I've never run into that before. The only erratic
PHP behaviour I've ever experienced that could be directly attributed
to a bug in IE was in the case of forms with multiple submit buttons
and different actions needing to happen depending on which submit
button was pressed and when the <button> tag was being used instead of
- » preg_replace: How to get ...->% or \... -> ... in one call?
- — Previous thread in » PHP Scripting Forum