API to hibernate tabs?

已查看 186 次
跳至第一个未读帖子

Nathan Pierce

未读,
2023年2月4日 10:55:362023/2/4
收件人 Chromium Extensions
I'm curious if anyone knows of a way for chrome extensions with tab access to hibernate them? I can store state in my extension, remove tabs, and then restore them when the user wants, but I was hoping chrome could do this natively.

wOxxOm

未读,
2023年2月4日 12:00:562023/2/4
收件人 Chromium Extensions、nors...@gmail.com

Nathan Pierce

未读,
2023年2月4日 13:50:102023/2/4
收件人 Chromium Extensions、wOxxOm、Nathan Pierce
Perfect! thanks!

Nathan Pierce

未读,
2023年2月4日 15:01:132023/2/4
收件人 Chromium Extensions、nors...@gmail.com、wOxxOm
Do you happen to know how to resume the tab? I tried to update with active: true, but that doesn't seem to work.

wOxxOm

未读,
2023年2月4日 15:25:232023/2/4
收件人 Chromium Extensions、weareo...@gmail.com、nors...@gmail.com、wOxxOm
Judging by the description it's not really hibernation, it's essentially like task killing so nothing remains except an entry in the tab strip. It mentions reloading which probably means you can also do it via chrome.tabs.reload()

ONLYHUMN

未读,
2023年2月4日 15:28:362023/2/4
收件人 Chromium Extensions、wOxxOm、ONLYHUMN、nors...@gmail.com
Yep, reload works... Yet, other methods under chrome.tabs seem to claim they can't find the tabID after it's discarded... lol

Belly King

未读,
2023年9月6日 09:05:112023/9/6
收件人 Chromium Extensions、ONLYHUMN、wOxxOm、nors...@gmail.com
Hi, does chrome.tabs.reload  actually work? Say I have a tab with id 123, when this tab is discarded, calling chrome.tabs.reload(123) does not work for me...I get tab id does not exist error.

I am building an extension to manage tabs. If the tab discarded, I cannot find a way to update the discarded one with new tab id...

I listen to the  chrome.tabs.onUpdated  event. When tab(id=123) is discarded it is like this:

chrome.tabs.onUpdated: tabId: 456, tabChangeInfo:{ discarded: true, status: "unloaded" }

This is no way for me to know that tab 456 is actually linked to tab 123.

kg_17

未读,
2023年9月6日 10:04:002023/9/6
收件人 Chromium Extensions、Belly King
https://bugs.chromium.org/p/chromium/issues/detail?id=910968

The id of a tab changes when a tab is discarded.  You can listen to chrome.tabs.onReplaced to get the new id.

Also, in case you are not aware, chrome.tabs.reload loads an up-to-date version of a page.  Form data, page position, etc are lost when a discarded tab is reloaded.  However, if a discarded tab is activated, the tab is restored properly.
回复全部
回复作者
转发
0 个新帖子