Issues with iPad's ajax functionality

After a lengthy process, I was tasked with developing a chat feature that functions flawlessly on various devices but seems to be glitchy specifically on the iPad and possibly the iPhone. The client heavily relies on their iPads for communication, so solving this issue has been my main focus for the past 7 months.

Finally, after months of troubleshooting, I have been able to identify the root cause of the problem.

The culprit appears to be the browser in iPads. I use JSON Ajax requests through jQuery library, and while the requests themselves are error-free, the iPad stops processing Ajax requests at a certain point. Despite thorough logging of every request, the server suddenly stops receiving any requests without any clear explanation. The client assures me they are actively using their iPad during this time to prevent it from locking up.

Even reducing the request rate to just 15 per minute did not resolve the issue.

Therefore, my inquiry is: Has anyone encountered a similar issue where iPads cease sending Ajax requests after a short period of time?

Answer №1

Placing this information here since there is no syntax highlighting in the comments.

Check out a very basic test page I created:

The code snippet is as follows:

<?

if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {

echo date("F j, Y, G:i:s a");
exit();

}

?>
<!doctype html>
<html>
<head>
    <title>AJAX test</title>
</head>
<body>
    <h1>Ajax Test</h1>
    <p>This page sends an AJAX request every 5 seconds and updates the div below with the returned date.</p>

    <div><p id="date"><?= date("F j, Y, G:i:s a") ?></p></div>
    <div><p><span id="count">0</span> updates made.</p></div>

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    <script>
    var count = 0;

    var getDate = function() {
        $.get('/tests/ajax.php', function(data) {
            $('#date').html(data);
            count = count + 1;
            $('#count').html(count);
        });
    }
    setInterval(getDate, 5000);
    </script>

</body>
</html>

I ran this for an hour without any issues on my fully updated iPad. The performance was consistent throughout.

I also tested this on Chrome and observed its behavior. Here's how it looked:

(Full size)

There were some anomalies where the number of event listeners initially remained constant, then spiked up to 56 before dropping back down to 1. The DOM Node Count also experienced fluctuations, reaching as high as 424. These behaviors are quite unexpected considering the simplicity of the code.

It's possible that your application may be tracking too many Dom Nodes or event listeners, causing the iPad to struggle to keep up with processing, or something similar.

Additionally, the memory usage steadily increased until garbage collection kicked in. While this is normal behavior, it might not be as efficient on the iPad.

Edit: When testing on a clean profile, I noticed that many Event listeners were due to extensions – the behavior remained consistent, though to a lesser extent. Background values were mostly at 0-1 rather than 15-20 as previously observed.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Replacing variables in a function: A step-by-step guide

I have frequently used the replace function to eliminate classes in JavaScript. Currently, I am working on creating a JavaScript function that allows me to remove a specific class from an element by passing in the element and the class name. changeAddress ...

Error: Appwrite Login Authentication failed due to account.createEmailSession function not recognized as a valid function

Looking for help with Vue and Appwrite? Check out this tutorial: https://appwrite.io/docs/tutorials/vue/step-1 src/appwrite/index.js import { Client, Databases, Account } from "appwrite"; const client = new Client(); client .setEndpoint(" ...

The .php file responds with an empty string after an AJAX request

Beginner Alert: Here is my first attempt at using AJAX, with a basic understanding of PHP. I am trying to make an AJAX post request to a .php file. Below is the code I have so far: var lat = results[0].geometry.location.lat(); var lng = results[0].geomet ...

Receiving a parseerror when trying to use AJAX to retrieve cross-domain data using WCF

While attempting to access a WCF Rest Service from Javascript using $.ajax, I encountered issues with cross-domain calls. Despite hours of research, I have made progress but am stuck on the final step. To begin, here is my client-side code: $.ajax({ ...

The PHP webpage is up and running smoothly, however, there seems to be an issue with the

When trying to update values in my code, I encounter an issue. Despite receiving all the data from my ajax call, I'm facing difficulties executing the query in 'update_details.php' via ajax. $(document).on('click', '#commitbt ...

When the Json payload is lengthy, an Ajax request to an ASP.NET MVC Controller results in a 404 error

I am facing an issue with my ajax call that involves passing a json string to a controller action. When the content portion of the json is too long, or when the json string in general exceeds a certain length, the server returns a 404 error. However, if I ...

Alter the color of the dropdown background when it is changed

Currently, I am utilizing the Semantic UI React CSS library and find myself in need of changing the background color of dropdowns once an option is selected. https://i.sstatic.net/yZBK7.png to https://i.sstatic.net/LxTtT.png <Dropdown placeholder=&apo ...

Is there any purpose to incorporating an AngularJS directive within a comment?

Hello, I'm curious about the purpose of using an AngularJS directive as a comment. I've seen some examples where it can display an alert message, even with arguments, but I'm struggling to see the practical use of a directive as a comment. C ...

Receiving a null response from an Ajax post request

I am facing an issue where a model object I am passing into a post Action in my web app contains null variables. The action looks like this: [HttpPost] [ValidateAntiForgeryHeader] public async Task<JsonResult> StartRound(RoundModel model) Here are ...

Tips for troubleshooting and fixing an Ajax Request in Laravel

Whenever I try to update the date, my goal is to trigger an ajax request that will fetch data from the controller. Unfortunately, I am facing some issues with writing the proper ajax code. Here's the snippet of my code: {!!Form::open(['action&ap ...

Adjust the CSS property of a div to have a fixed position when scrolling

I attempted to implement a fixed div on scroll in Vue.js using the following code: ... async created() { window.addEventListener('scroll', this.calendarScroll); } methods: { calendarScroll() { console.log('Scroll'); cons ...

Acquiring the Facebook profile_id and incorporating it into a URL using a Chrome Extension

Although I have limited knowledge of JavaScript, I believe I know enough to complete the task at hand; I just need some guidance. I am working on developing an extension that will extract the profile_id from the current Facebook page being viewed, and the ...

The Mongoose _id seems to be malfunctioning when a custom value is used instead of the default value

Greetings! I am currently working with Mongoose and have a collection named 'tag' with the following schema: const tagSchema = new Schema<ITag, ITagModel>( { _id: { type: String, unique: true, required: true, }, ...

Exploring A-Frame VR: Understanding the Distinction between Cursor and Raycaster

I'm in the process of developing a WebVR project that allows users to interact with the environment by 'clicking' on entities. Can you explain the distinction between using the cursor fuse attribute and the raycaster for interaction? ...

Utilizing pixel values for Material-UI breakpoints rather than using the default sm, md, lg, xl options

Below is the code snippet that I am using: [theme.breakpoints.only('lg')]: {} The above code works perfectly and shifts at the desired breakpoint. However, when I implement the following: [theme.breakpoints.between('1200', '1021&a ...

Vue Websockets twofold

I am experiencing some issues with Laravel/Echo websockets and Vue.js integration. I have set up everything as required, and it works, but not quite as expected. The problem arises when I refresh the page and send a request - it displays fine. However, if ...

Prevent resizable elements from expanding to 100% of the screen's height and width

Is there a way to create a condition for when a script is executed? I want the script to be disabled if a window in the browser reaches 100% width and 100% height. The script in question can be found here: element = document.getElementById("window&q ...

Sliding through various background options

How can I change backgrounds on a slider without using .style.backgroundImage? Is there a way to do it by adding a class to the slider or some other method? 'use strict' let backgroundSlides = ['url(\'/images/slider/burger-back ...

Assign individual heights to multiple iFrames according to their content's height

Dealing with multiple iframes on a single page. Each iframe is sourced from my domain. The goal is to automatically calculate and set the height of each iframe on the page. The current code sets all iframe heights to match that of a specific iframe: fun ...

An error occurred due to an unexpected identifier, '_classCallCheck', while the import call was expecting exactly one

Encountering an unexpected identifier '_classCallCheck'. Import call requires precisely one argument. Having trouble with React Native. I have attempted every solution found on the internet, but none proved successful. Is there any way to upgrade ...