Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detecting active tab is a new tab in chrome extension

Until recently it was possible, in a chrome extension, to know if the current tab was a new tab by checking if the tab url was "chrome://newtab/" however since the last update it seems that the new tab url is something like "https://www.google.[...]/webhp?sourceid=chrome-instant&[...]".

Is there a robust way to find if the active tab is newtab ? (I don't consider catching newtab event or having a superficial look at the url shape as robust)

like image 903
Ara Avatar asked Nov 02 '22 13:11

Ara


1 Answers

Use activeTab.url == "chrome://newtab/"

At least in Chrome Version 79.0.3945.88 (Official Build) (64-bit), to check if the current/active tab is a new tab, you can still do:

activeTab.url == "chrome://newtab/"

Maybe you have another extension or a configuration setting where it's defaulting your new tabs to a certain URL.

like image 150
Joshua Pinter Avatar answered Nov 09 '22 05:11

Joshua Pinter