Javascript XHR request throttled on background tab on mobile – solution?

Would like some assumption validation and opinions on solutions to a js xhr throttling problem I seem to be running into on Chrome on Android when the phone screen is off (browser tab is in background mode).

My use case is:

  • Phone has focus on Chrome browser tab but is asleep (screen off)
  • JS Webworker has a setInterval call which sends a msg to the main JS thread ever 10 seconds.
  • Main JS thread, upon receipt of web worker msg, issues an XHR request to get a file.

Behavior:

  • Files are queried for and received by the main thread for a period of time (5 min?) after the phone’s screen is off
  • At some point, file XHR requests begin to fail.

I’m seeing (from tests and reading) that the main javascript thread is throttling (and probably queueing up) xhr requests after X minutes. Can someone confirm this behavior and ideally point to documentation on what X minutes is and what actual behavior is?

I believe that switching the XHR request into the Webworker will solve my problem. So instead of the Webworker being only the timer that tells the main thread to make an XHR request, the Webworker actually makes the XHR request itself every 10 seconds and then sends the file in a msg to the main thread. Can someone confirm this approach will work?

Kind of a big code change so want to source some opinions before doing it. Thank you.


chrome v56.0.2924.87
android v7.1.1


Source: stackoverflow-javascript

post "slide" to the right when embedding tweets or Instagram in WordPress

I am using Sahifa wordpress theme.

When ever I embed tweets or Instagram pic in a post the post page slide to the right and return to the center.

it is happeing only on mobile and only in the post page

The author told me to add this code to the “Global CSS” section in the (Theme Settings page >> Styling):

.entry{
    overflow: hidden;
}

it didn’t help.


Source: stackoverflow-php