iOS-Browser | A simple iOS web browser | Android library
kandi X-RAY | iOS-Browser Summary
kandi X-RAY | iOS-Browser Summary
A simple iOS web browser (Swift 5 + WebKit)
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of iOS-Browser
iOS-Browser Key Features
iOS-Browser Examples and Code Snippets
Community Discussions
Trending Discussions on iOS-Browser
QUESTION
My Django project has a number of buttons on the web page that do POST requests to the main view.py
which in turn handles the action and returns a 204 No content
response. The results of the action show up asynchronously later on the web page (at the time the response is generated there's nothing new to show).
On any non-iOS based browser the 204 response works fine and the web page remains in the browser, as expected from RFC 7231.
Unfortunately all iOS based browsers I've tried (Safari, Firefox, Chrome) navigate to a blank page after the POST, which is not what I want (see this question). Apparently this is a long standing bug in WebKit.
Is there any way to achieve the same thing across all browsers? ie. Click button, POST, web page stays as is, change appears later. I've looked at this but no sure it's really what I'm after. Changing the response code is possible but I don't see a viable alternative that doesn't navigate away from the current page. My current hacky fix is to reload the whole page for an iOS device, but this moves the page if the user had scrolled down earlier so looks pretty janky.
...ANSWER
Answered 2020-Apr-13 at 01:37The solution for this is contained in this question and the answer by Terry. Plus some other info about handling the CSRF protection in Django.
The short answer is to override the regular form submit with event.preventDefault()
in your own onsubmit
function for each form. Then do the POST asynchronously with JQuery. This avoids the server having to return an HttpResponse with status 204, or anything really, beyond an empty JsonResponse.
There are several forms on my web page so I don't have a single function assigned to each button, like in the above linked answer, but several that change individual button behaviour. Also for Django there's the added consideration of including the CSRF token in the POST request.
So, for example, some html with two buttons;
QUESTION
We have a weird situation where our javascript fails on specific browser.
Before we had a similar problem with Firefox, now we've got an error for Safari/iOS-browsers. Based on my further experiences most likely the age
is NaN
. As iPads browsers doesn't have any sort of console I cant validate that.
HTML Markup:
...ANSWER
Answered 2017-Apr-13 at 10:02Solution was to change one line from
var dateString = year + ", " + month + ", " + day;
to
var dateString = year + "/" + month + "/" + day;
Weird.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install iOS-Browser
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page