Long story short: For example, A landing page called page A and is accessed directly, After clicking something on page A, The IOS safari browser takes you to page B, Then when back button is clicked the browser takes you back to page A, And then all search boxes and select option dropdowns on page A will no longer work, Unless you refresh the page.
Key notes:
1, This does not happen in any PC or Android devices and happens to all of the latest IOS versions, Presumably Any version later than IOS 15.
2, Given how IOS back button works, This isn’t technically an IOS bug, The following code would fix the problem in most cases.
(function () {
window.onpageshow = function(event) {
if (event.persisted) {
window.location.reload();
}
};
})();
3, I have done the following to locate the problem, Lane by lane eventually Wiping out every single line of code of the entire project, And added a simple form with a search box and a submit button to index.html with no css, no js, no backend, nothing except the following code:
<form>
<input type="text" name="search">
<button type="submit">Go</button>
</form>
If you type anything in the search box click go and then click the back button, The search box will no longer be responsive(The keyboard will no longer pop up), Same with select-option dropdowns.
Here is what I found, This bug seem to only exists to websites that uses Cloudflare, At first I thought it was the cache, I have purged all caches on Cloudflare, Clicked developer mode to temporarily disable the cache, It didn’t work, That’s when I deleted everything except an index.html with a simple form, The problem persists, And since websites that has nothing to do with Cloud flares don’t seem to experience such bugs, It might have something to do with Cloudflare, It also doesn’t make sense a proxy service like Cloudflare would cause a simple html page to bug with IOS back button, But it can’t be the code either, Every single line of code was deleted except a simple html test form with no CSS no JS nothing, What’s causing it?