X
Tryk her for at gå til webstedets mobilversion.

Supportforum

close unused tab after 30 minutes extension

Skrevet

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.
Citér

Yderligere systemdetaljer

Program

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

Yderligere information

Luk
jscher2000
  • Top 10 Contributor
8637 løsninger 70648 svar

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
Fandt du dette nyttigt?
Citér

Spørgsmålsstiller

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)
Fandt du dette nyttigt?
Citér
TyDraniu
  • Top 25 Contributor
309 løsninger 1726 svar
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
Fandt du dette nyttigt?
Citér
Stil et spørgsmål

Du skal logge ind på din konto for at svare på et indlæg. Start et nyt spørgsmål, hvis du ikke har en konto endnu.