0

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.

user1995565
  • 165
  • 1
  • 10
  • Possible duplicate of [A http 204 response returns a blank page in iOS, is there a way to stop this?](https://stackoverflow.com/questions/51351482/a-http-204-response-returns-a-blank-page-in-ios-is-there-a-way-to-stop-this) – Joseph Sible-Reinstate Monica Oct 20 '18 at 21:31
  • 1
    Maybe I'm misunderstanding, but would I still use a return ('', 204) with Flask since I still need to return something? I tried hooking a e.preventDefault() into my JQuery submit form script but am getting the same results on the iOS device. – user1995565 Oct 20 '18 at 21:55

1 Answers1

0

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.

user1995565
  • 165
  • 1
  • 10