X
Toque aqui para ver a versão para dispositivos móveis desse site.

Fórum de suporte

close unused tab after 30 minutes extension

Postado

hi i am working on Firefox extension and one of the feature is to close tabs automatically if a tab is inactive from last 30 minutes. i am not sure where to get started with this looking forward to get some suggestions.

hi i am working on Firefox extension and one of the feature is to close tabs automatically if a tab is inactive from last 30 minutes. i am not sure where to get started with this looking forward to get some suggestions.
Citar

Detalhes avançados do sistema

Aplicativo

  • User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0

Mais informações

jscher2000
  • Top 10 Contributor
8632 soluções 70600 respostas

Hi sanam204, what is your definition of inactive?

Your extension can check when each tab was last accessed and confirm that it is not the active (focused) tab in the window. Those are properties of each tab and you can access them without any special permissions. See:

https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/tabs/Tab

However, understanding what is happening with the content in the tab may require injecting scripts into tabs, which requires a lot of permissions. I wouldn't recommend that as your "version 0.1" approach unless it's critical.

The Add-ons team has a forum for extension developers over here:

https://discourse.mozilla.org/c/add-ons/development

Hi sanam204, what is your definition of ''inactive?'' Your extension can check when each tab was ''last accessed'' and confirm that it is not the ''active'' (focused) tab in the window. Those are properties of each tab and you can access them without any special permissions. See: https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/tabs/Tab However, understanding what is happening with the ''content'' in the tab may require injecting scripts into tabs, which requires a lot of permissions. I wouldn't recommend that as your "version 0.1" approach unless it's critical. The Add-ons team has a forum for extension developers over here: https://discourse.mozilla.org/c/add-ons/development
Este artigo foi útil?
Citar

Autor da pergunta

Hi jscher2000 thanks for your reply, by inactive I mean any tab which I’m not currently using (for examples I have opened 6 tabs in the browser and 2 of them i haven’t clicked from last 30 minutes so I want those 2 to get automatically closed after 30 minutes)

Hi jscher2000 thanks for your reply, by inactive I mean any tab which I’m not currently using (for examples I have opened 6 tabs in the browser and 2 of them i haven’t clicked from last 30 minutes so I want those 2 to get automatically closed after 30 minutes)
Este artigo foi útil?
Citar
TyDraniu
  • Top 25 Contributor
309 soluções 1719 respostas
These exemplary extensions should help you: https://github.com/mdn/webextensions-examples/tree/master/chill-out https://github.com/mdn/webextensions-examples/tree/master/tabs-tabs-tabs
Este artigo foi útil?
Citar
Faça uma pergunta

É necessário entrar em sua conta para responder a este tópico. Por favor, faça uma nova pergunta, se ainda não tiver uma conta registrada.