Window.focus
From GreaseSpot Wiki
Description
Calling window.focus()
will make browser switch the tab of User script,
without registration of service worker.
This API does not require @grant in metadata block.
Calling this function in normal JavaScript context in invalid because the permission to focus a window require a service worker. See WindowClient.focus.
Examples
GM.notification("you can switch to the tab", "focus", '', () => { window.focus(); alert("you are in the tab now"); });