0

My extension is designed to control music playback on the music.yandex.by web-site. When user click buton in popup I am passing message from background to content script. While the music is playing, everything works as it should. However, if you stop the music and switch to another tab, after about 5 minutes the content script stops receiving messages, while the background script continues to receive messages.

Here is manifest

{ "manifest_version": 2, "default_locale": "en", "name": "__MSG_extension_name__", "description": "__MSG_extension_description__", "version": "1.0", "content_scripts": [{ "js": [ "content.js" ], "matches": [ "*://music.yandex.by/*" ] }], "background": { "scripts": ["background.js"], "persistent": true }, "web_accessible_resources": [ "images/my-image.png" ], "action": { "default_icon": "toolbarItemIcon.pdf", "default_title": "Открыть Яндекс Музыку" }, "externally_connectable": { "matches": [ "*://music.yandex.by/*" ] }, "permissions": [ "nativeMessaging", "*://music.yandex.by/*" ] } 

I use ports to communicate between the background script and the content script.

I believe that after a certain period of time, the inactive page goes into standby mode and disables the content script. Is there any way to bypass this limitation?

I would be very grateful for any advice.

4
  • Probably this question and answer could help. Basicly you need to prevent the content script unloading due to some idling timeout, applied by modern browsers. Commented Mar 5 at 13:12
  • @Stan thank you for your reply. I checked in the web inspector - the content script remains loaded. Commented Mar 5 at 13:34
  • Try sending a dummy message every minute through the port. Commented Mar 5 at 17:26
  • @woxxom, It doesn't work. The tab still goes into standby mode. Commented Mar 21 at 7:23

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.