Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What happens (or doesn't happen) in a chrome tab opened in the background?

Observation: I am running an SPA in Polymer and when I open internal links in new background tabs in chrome, the pages don't finish loading (ajax and all) until I focus on the tab.

Questions: What is chrome waiting for user focus to do -or- What is Polymer waiting for before it finishes rendering the page and sending ajax requests?

Bonus: How can I open a dev tools panel targeting a tab I have opened in the background to observe what is/isn't happening?

Bonus Answer: If you open dev tools on a tab, navigate away from the tab, then refresh the dev tools, the associated tab will also refresh and simulate having been opened in the backgroun.

like image 991
km6zla Avatar asked Aug 25 '15 19:08

km6zla


People also ask

How do I keep tabs active in the background?

Here is how it can be done. To make a background tab active in Google Chrome automatically, you need to do the following. Press and hold Ctrl + Shift keys together on the keyboard, and only then click the link that you want to switch to immediately.

Why do my tabs disappear in Chrome when I go full screen?

If you're in full screen mode, your toolbar will be hidden by default. This is the most common reason for it to disappear. To leave full screen mode: On a PC, press F11 on your keyboard.

Does Chrome suspend inactive tabs?

This feature is enabled by default in Chrome and works in the background without needing the user's input. Tab Freezing only suspends unused tabs when system memory is running low. The tabs continue to appear in the tab strip and reload when clicked.

How many tabs do I have open in Chrome?

As noted on Chrome Tricks, to get a count of tabs in each window, right click on any tab and select Move Tab to Another Window. Save this answer. Show activity on this post. Just close the window and open Chrome again to load the tabs into history (if you have history enabled).


1 Answers

In Polymer, core-ajax with the auto attribute set to true uses Polymer job utility (source). Polymer's job utility uses the requestAnimationFrame() function (source). According to here and here, chrome pauses on this function completely when the tab is inactive.

Solution: By removing the auto attribute from my core-ajax elements and manually calling the go() method on the ready event, I was able to get my pages to fully load in the background.

like image 147
km6zla Avatar answered Oct 28 '22 19:10

km6zla