0

I'm making a Chrome extension that will open the first few links of a particular webpage in tabs. All of these pages contain a SWF and I would like that to start loading when the tab is created, while the original tab remains active. But, right now, all of the content except the SWF loads fine, but the SWFs don't start loading until you manually click on the tab, which sort defeats the purpose of this particular extension.

I know this is a feature of Chrome, but I was wondering if there is a way to go around it or toggle it off.

This is the code I'm using in my background.js file to create new tabs for a handful of URLs:

function openTabs(urls, waitTime){
  if(urls.length > 0){
    chrome.tabs.create({ url: urls.shift(), active: false});
    setTimeout(function(){
                openTabs(urls);
                }, waitTime);
  }
}

Based on initial searching, I wondered if these tabs were being discarded to save memory but chrome://discards/ shows that they have not been.

One possible work-around would be to use a wait time of a couple of seconds and start each tab as active to give the Flash player time to start loading and then switch back to the original active tab when all tabs have been opened, but I'd like to avoid that if possible because it seems annoying to the user.

Per @Teyam's suggestion I tried setting the wmode param to window for the Flash player, but that didn't do the trick, unfortunately.

Is there a way I could force Flash to start loading when I create a new inactive tab?

s.py
  • 197
  • 10
  • That is the correct behaviour of Chrome. It does not render media data in a new (inactive) tab until a user goes to that tab. Test it with some page of an auto-play video (use HTML5 tag)... Do you hear sound as soon as you "_open link in new tab_"? Nope, got to interact with tab first .. – VC.One Nov 29 '16 at 06:55
  • @VC.One Yep, I get that. I was wondering if it was possible to change that behavior in an extension. – s.py Nov 29 '16 at 12:40
  • Just found this question, which seems about the same but for an older version of Chrome: http://stackoverflow.com/questions/32972922/force-tab-to-render?rq=1 May try the workaround presented in an answer. – s.py Nov 29 '16 at 14:05
  • You might want to try using Flash object's param `wmode=window` in your code as suggested in this [SO post](http://stackoverflow.com/a/6343583). I haven't actually tried it but the solution given looks promising and might work for you too. Additionaly, you might want to also check this [SO post](http://stackoverflow.com/questions/886864/differences-between-using-wmode-transparent-opaque-or-window-for-an-embe) to know the different flash 9 `wmode` settings. – Teyam Nov 29 '16 at 16:53
  • @Teyam Hmm... doesn't seem to do the trick in Chrome but thanks for the tip and flash info – s.py Nov 29 '16 at 18:23

0 Answers0