Firefox – How to make a tab in Firefox falsely believe that it still has the focus


In Firefox I would like to pass to another tab while an ad is playing
in the current tab, but the pesky thing will pause when its tab loses the focus.

I would like to trick the ad to believe that it still has the focus,
for it to keep on playing so I don't have to wait for it to finish.

How can I make a Firefox tab falsely believe that it still has the focus ?

You can make the assumption that the page is using techniques described here.
window.onfocus and window.onblur are probably used. I don't remember where exactly I needed this when I asked the question; this is not necessarily used to trick ads. I'm looking for a generic solution.

Best Answer

Since you have not provided details of the website, here is one solution you can try.

  • Install the Greasemonkey extension to allow you to run user JavaScripts on websites of your choice.
  • Install the Always on focus userscript.

    Script Summary: Some pages check the document.hidden property and won't render content unless the page is in focus. This script will trick them to think they are in focus so you can preload them in a tab and visit them when they have finished loading.

  • Configure the script for specific websites, as desired, while installing (or later).