Target.isUnloaded() method
Returns true if the target is a "tab" target and the tab has no loaded document, for example after a discard, after session restore without a load, or after a renderer crash.
Signature
class Target {
isUnloaded(): boolean;
}
Returns:
boolean
Remarks
An unloaded tab without a page target (for example, a discarded tab or a tab that session restore did not load yet) returns null from Target.page(), throws from Target.asPage(), and is not included in Browser.pages(). A crashed tab keeps its page target, so Target.page() still returns its Page.
A Page that is open when its tab is discarded closes. When the tab loads again, it gets a new page target and a new Page.
Puppeteer emits targetchanged for the tab target when its unloaded state changes.
Only supported for Chrome and the CDP protocol. With WebDriver BiDi, returns false.