LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Firefox Specific Refresh Problem. Ffox Can't remember redirected URL after ajax call (https://www.linuxquestions.org/questions/programming-9/firefox-specific-refresh-problem-ffox-cant-remember-redirected-url-after-ajax-call-739557/)

supertramp 07-12-2009 11:38 AM

Firefox Specific Refresh Problem. Ffox Can't remember redirected URL after ajax call
 
Hi.
I couldn't get worked following script with firefox 3.0.4 as I expect.
(With ie and konqueror it works as expected but not with firefox.)

Code (test.php): http://paste-it.net/public/u76374a/

This code serves ajax response if $_GET['ajax'] is set, and serves whole html page if $_GET['ajax'] not set.

Goal of code:
if user makes a page request or hits refresh button after an ajax call, redirection to same page must be occured with some $_GET values (for example: 'test.php?redirected=true').

Problem:
test.php does the goal said above - no problem.
For example if user makes a page request after an ajax call redirection occurs.
Or if user hits refresh button after an ajax call redirection occurs.
But problem comes with second refresh. if refresh button clicked second time, firefox goes to the URL which was in URL bar before the redirection occured.

Demonstration of problem:
1- On firefox, load url 'localhost/test.php'.
2- To make an ajax call click on 'will be changed?' text. After click, text must be turned to "yes, changed". That was an ajax call to test.php.
3- Hit refresh button. Because of refresh is after an ajax call, redirection occurs to 'test.php?redirection=true'.
-- So far so good. I want exactly this behaviour --
4- (Problem starts) If refresh button clicked second time firefox goes to last URL entered before redirection ('localhost/test.php'), not to 'test.php?redirection=true'. In other words, firefox doesn't behave redirected URL (which occured after an ajax call) like current URL in URL bar. It behaves like last URL entered by hand is still in URL bar, supposing that redirection never happened.

Some workarounds:
** On first step of demo; if url 'localhost/test.php?some_variable=some_value' was loaded, on step 4 firefox goes to 'localhost/test.php?some_variable=some_value'. So I said "...firefox goes to last URL entered by hand before redirection..."

** On step 4; if I press Enter when cursor is in URL bar (Instead of clicking refresh button), firefox goes the URL 'test.php?redirection=true'. So, no problem with 'test.php?redirection=true' URL. So I said "...firefox doesn't behave redirected URL, which occured after an ajax call, like current URL in URL bar..."


Bug in firefox?
Bug in script (test.php)?
Incompatible code?
I miss something??

Please help.

PTrenholme 07-13-2009 08:07 PM

Have you verified the problem in FF 3.5? (3.0.4 is a fairly old release.) I'd try it myself, but I don't run any servers on my laptop. :)

supertramp 07-20-2009 07:33 AM

Quote:

Originally Posted by PTrenholme (Post 3606676)
Have you verified the problem in FF 3.5? (3.0.4 is a fairly old release.) I'd try it myself, but I don't run any servers on my laptop. :)

I have limited Net connection so I didn't try FF 3.5 . I will report as soon as I update my system.


All times are GMT -5. The time now is 08:45 AM.