0

here is my problem :

What I want : I'm wondering if it's possible to have access (to change them) to renderings settings from an extension in Chrome. I know some APIs exist like DevTools API but I cannot find a way to change any of these rendering settings from my extension.

Rendering tab in DevTools

1

What I want more specifically : I made a Chrome extension and I want it to make a specific tab think it's focused, even if it's not. I know I can do it manually by opening Chrome DevTools panel and enabling "Emulate a focused page" but I really want my extension to do it programmatically.

Why I want to do this : Some websites don't behave the same when the page is not focused, so I want my extension to make their behavior consistent.

Do you think it is possible ? Thx :)

I've been searching online for a week now and I really can't find any solution to my problem...

vimuth
  • 5,064
  • 33
  • 79
  • 116
zcb
  • 21
  • 2
  • 1
    I don't think it's possible, but if you were more specific about "Why I want to do this" someone might suggest an alternative. – Norio Yamamoto Dec 18 '22 at 09:37
  • @zcb --- I agree with NorioYamamoto. It would be nice if you provided us with links to at least three websites that don't behave the same when the page is not focused. And please let us know why this difference in behavior is a problem for you. – Thomas Mueller Dec 18 '22 at 11:14
  • This is a well-known but broad problem because sites use many techniques like `document.hasFocus()`, `blur` event, requestAnimationFrame (it runs only when the tab is visible). An extension can fool the site by overriding all these in [page context](/a/9517879). You'll have to debug the site's scripts to find the methods it uses. – wOxxOm Dec 18 '22 at 11:17
  • The simplest solution is to use `chrome.debugger` API and send [setFocusEmulationEnabled](https://chromedevtools.github.io/devtools-protocol/tot/Emulation/#method-setFocusEmulationEnabled) command, but it shows a persistent warning about debugging above all tabs. – wOxxOm Dec 18 '22 at 11:20

0 Answers0