-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Forms not working anymore in macOS Firefox (latest) #182
Comments
Hi Tchapi, thanks for pointing that out! I have forwarded it to the guy who debugged the last version. (it reads as if it were specific to the latest version?) EDIT: Works on Firefox for Windows 10 against 4nf.org and another test site - however, these employ GETs Thanks and regards, |
Thanks. I don't know if it's specific to the latest version, but the exact same site has different behavior on both navigators, and it wasn't this way before, hence my issue... |
Alright - thanks. We'll see what the other guy says... I'm off for the evening - please don't be irritated. |
Hi @tchapi, I'll need some additional information about your website preferences for ajaxify and form data that is sent to the page because I couldn't reproduce your issue on Firefox for windows (for both types of request POST/GET). My current opinion is that it's not related to POST/GET type of request, also have something else on my mind, could you please try the testpatch branch ajaxify file from this link on your development environment and tell us if it behave the same or not? |
Hi and thanks for your answer I tested with your version but it's the same : Chrome OK, FF NOK. Here is my config :
The form is extremely simple :
When inspecting the two behaviors, the only difference I see is that on Chrome, once the POST comes back with a 302 redirect, Chrome goes fetching (GET) the redirection target without specifying a content-type in the request. On the other hand, FF explicitely specifies "application/x-www-form-urlencoded" as content-type in this GET request, and that may trigger an additional GET afterwards ? I'm a bit lost ... |
Hi @tchapi, just my fifty cents:
has be changed to
in the latest versions ... in order to compare apples to apples. |
Hi again, too many questions is passing through my mind. I would like to know if everything works fine on windows firefox browser for your website. To be sure that it's a specific platform&browser issue. Next thing, I'll recommend you to find this line (264) in latest version One more thing, I'll recommend you setting |
Alright, with the Digging deeper, I have the impression that Firefox gets the response base64-encoded (whereas Chrome / Safari does not). I don't see which header would trigger this, but this is what could trigger a |
Hi, ok, we found the source of the issue. However I would like to be sure that everything works fine on windows platform browsers for your particular case, if it's possible, to know is it a platform related issue without some hidden bugs. Since I'm not great with writing those header checks, I would like to hear what @arvgta has to say about it. |
Hi @edito, thanks for all your efforts and finding the line that was causing this issue. @tchapi : It would be interesting for the records additionally, to know whether turning off prefetch before commenting out that line with:
...made a difference? Thank you both! |
I tested a bit more :
|
Ok, thanks, very interesting! But when commenting out the line:
...it works on all browsers, right? |
That's exact |
A fix would be to allow |
Is that satisfactory then for all of us as a deliverable of this issue? (I mean commenting out that line:
) |
It's not satisfactory for me — I don't want to modify the ajaxify source code since I want to keep being updated ;) I'm not an expert enough with MIME to know if allowing What do you think @edito ? |
Obviously, I mean actually modifying the release code of Ajaxify centrally. |
Yes but I think you should keep the |
Ok, just another idea - in that case we could specify all thinkable MIME types that we accept in one go? Let's see what @edito says... |
As I understood, this check is here in case that ajax request fails somehow and then it forces standard page navigation as escape metod. My recommendation would be changing approach to something that is easier and more unifying to check, those headers seems unstable and can vary from browser to browser, even with possibility of changing in future. Condition can be written to check if xhr returned success (even with some simpler additional checks, for example that data is not empty or that fetched data contains some tags specific to html as head/body, that should do the work with less chance to get false positive). What you think? |
Exactly - it enforces, that only HTML-like content can be swapped-in, otherwise, it "jumps" to the link. Great idea - I think we should choose the most generic check, and something like that seems to be most generic. I also agree, that we have little influence on the ways how these headers can vary. I would suspect, that we are not the first people looking for validation like that and we should research the web for a suitable check in JS/jQuery and simply reuse it... (My mistake originally, for thinking that the MIME type is the only way to go) |
What do you think of this thread at Stackoverflow? We could alter this existing code: return (d = x.getResponseHeader("Content-Type")), d && (d.iO("text/html") || d.iO("text/xml")); to return (d = x.getResponseHeader("Content-Type")), d && (d.iO("html") || d.iO("form")); ...that is, if checking for the substring "form" generically makes sense? |
@tchapi mentioned that he is getting something like base64 encoded headers in macOS firefox. This won't work if text is encoded. But if It will look like this:
or to perform more code reduction, it's possible to pass responseText right from call
inside isHtml function, but I don't know how will this last reduction behave in case of error. What is your opinion? |
Thanks very much Edin. My opinion is, that we should do things as similar as possible to other authors, as this surely ought to be a frequently performed task. That's why I recommended the approach above (Stackoverflow thread). If we actually search the Because this issue of @tchapi is the first one of its kind throughout the life of Ajaxify, it might be worth considering, whether he should not simply patch it for his own use case? I did a second, similar search just now, and this was the top Google result: (again, they check the MIME type) I also found this incomplete list of MIME types Apparently, Ajaxify is not checking for XHTML correctly by doing:
It should rather be something like:
...which specifies it cleary... |
I don't think you should do that. The patch should be compatible and safe for everybody. I think the best option is your proposal :
|
Thanks! I'll do that exactly after reading this on form MIME types as well, however with tweaking XHTML support, while we're at it:
(that's if we all agree :) ) Ah ok - "html" is a substring of "xhtml" already -> so this is enough:
|
Superb ! |
@tchapi : If you find that the change does the job, I will be happy to create a new version for you... |
@arvgta you are right, I completely forgot about other occurences of html/form inside response text, even in JSON response content. Insane oversight. Also I realized that it shouldn't be nice to perform indexOf search on huge string for every request, matter of performance. Hope @tchapi would return positive feedback and that issue is resolved. |
@edito - No worries! :) |
It does work now indeed ;) |
That's good news - thanks! I will create a new version later on. If any of the two of you feel like it, you could check for any more MIME types, we should support... If we are missing valid MIME types to permit, we are effectively locking-out users by mistake... |
I would like to keep this issue open for a short while, until we all agree, that we have included all salient MIME types... |
👍 |
Our substring "html" seems really good - hardly any unintended matches Can you spot any common MIME types, that we are missing? After reading this article on form MIME types again, I could imagine specifying
instead of
... in order to avoid unwanted matches What do you think? |
Thanks! Done :) ("form" replaced by "form-") |
Hi
I have an ajaxified page with a simple POST form. In macOS Chrome, it's working fine (ajaxify posts the form, gets the response, displays what it should). On macOS Firefox, ajaxify does what it's supposed to do, BUT the page is reloaded anyway (another GET is issued).
How can I mitigate this issue ?
Thanks a lot !
The text was updated successfully, but these errors were encountered: