iosgoogle-chromeflaskhttp-status-code-204

iOS devices with browsers such as Chrome can't handle a 204 response. For my Flask app, what alternatives do I have?


I noticed that my Flask app when accessed via Chrome on an iOS device cannot handle an empty response, return 204, correctly. It redirects to a blank page. The intention (as it works on Android and a Windows desktop with any modern browser) is to play the JavaScript animation, and to POST data. Since Chrome and other browsers have not issued a fix for over 4 years, what alternative do I have with Flask for POST'ing the data and remain on the page with Flask? The method does need to return something, after all.

Edit: The current suggested solution does not appear to solve my issue, as the results are the same after implementing e.preventDefault() for my jQuery that is submitting the form.


Solution

  • I learned that I could simply perform an Ajax call instead of relying on the return 204. I POST'd the data with Ajax and had Flask return with a 200.