What can I do if all HTML links refresh site instead of redirecting properly (FF only, HTML 1.0 Strict valid, no plugins) just after using autocompleted url?
I was testing a XHTML 1.0 Strict valid website on my localhost. It had URL "http://localhost/visaita/tictactoe/Web/index.php?item_id=8&game_password=73|55fc84c0c432ad625a901caaa13108aa&chat_code=74|50b3b60c8be203.98819772#.ULO2EnC23XQ". If I click in URL field between 8 and ?. Then pres shift + end and delete the rest of URL, I get a drop down of suggestions. Then I press arrow left in my keyboard - suggestions dissappear. I press enter and my URL is immediately reset to initial one (with all arguments) even though I wanted to delete them. Server receives all the arguments, so this is not the case of a back-end redirection (tested).
The most interesting effect is that after such refresh ALL HTML LINKS stop working. They refresh page instead of redirecting. Even if I click on a link redirecting to another domain, page still gets refreshed and not redirected. I see it as an obvious and serious bug which happens in very special conditions.
All FF plugins and add-ons disabled. Tested in safe mode as well. One interesting fact is that this page is opened by a redirect from another page (JavaScript performs redirect), but the page where error happens does not contain any JavaScript redirection code. Error console is also empty.
During these redirects FireBug (when enabled) displays interesting stuff. It shows that request without arguments is pending infinitely while immediately after it another request is launched with all unwanted arguments.
Another interesting fact is that page is using late polling AJAX technique (not sure whether it has any impact).
It seems that it is some caching bug.
Solusi terpilih
Ok, I know the reason now. Not sure it should work this way though. When page is reloaded, ajax requests are cancelled but as a result to that readyState becomes 4 and responseText carries empty content. This means that even though request is cancelled my JavaScript code still receives ajax response which is not expected and does not carry valid JSON format. As a result and my fail-safe feature, JavaScript code reloads the page. Even though a link is already pressed in page, my JavaScript manages to change the location of redirection to the same URL. In other words reload happens instead of redirection.
Baca jawaban ini dalam konteks 👍 0Semua Balasan (3)
It seems that it is related to late polling. If ajax is in the middle of work, links refresh page. If JavaScript is not in the middle of ajaxing, everything works fine.
Autocompleted URL does not seem to be related in order to provoke the bug. If I press Esc and then immediately press on links, they all work fine. Without pressing Esc, if long polling is in action, all links redirect the same page. Long polling request happens for no longer that 2 minutes and then there is a 1 second JS delay before the next one. If links are pressed between calls, they work fine.
The strange thing though is that my friend has prepared a simple script which is generating a long polling request and has a link to Google. This test works, so I am trying to understand whether there is any additional factor which is causing the problem. Perhaps it can be due to having redirects and 2 simultaneous long polling requests at the same time. Doing my best to understand the problem. Not sure what is happening although I am quite sure that problem is caused by the FF browser somehow. Tested everything back and forth.
Solusi Terpilih
Ok, I know the reason now. Not sure it should work this way though. When page is reloaded, ajax requests are cancelled but as a result to that readyState becomes 4 and responseText carries empty content. This means that even though request is cancelled my JavaScript code still receives ajax response which is not expected and does not carry valid JSON format. As a result and my fail-safe feature, JavaScript code reloads the page. Even though a link is already pressed in page, my JavaScript manages to change the location of redirection to the same URL. In other words reload happens instead of redirection.