I'm trying to use browser.tabs.query
in my WebExtension. It doesn't work in the case where the tab title does not match exactly.
What's more confusing is that docs say this about the parameter for title
:
string. Match page titles against a pattern.
So, I tried providing a RegEx string with case insensitive flag, but that doesn't seem to work either. Is there a way to get case insensitive matching?
The WebExtensions source code indicates that only an exact match is tested for the title
property. This is different than Chrome, which does use a match pattern for title
.
If you want a case insensitive match, or to use a RegEx, you will have to perform the tabs.query()
without the title
property and then filter the resulting tabs yourself based on the tab.title
property.