How to detect tabs change URLs or tabs create on Google Chrome Extension?

What you are describing is called a content script. You don't need any coding for that, just make a declaration in the manifest file. More about content scripts here.

Thanks for your comment. You got me wrong, I think. Because I use for the manifest file, but it works only one time when the extension starts.

Ok, for example, I would alert("HELLO! "); in the background.html. So whenever I turn the extension on, it alerts " But when you change the page URL, or open new tabs...it won't run again.So how do I detect those situations where the tab urls are changed, or new tabs are created... x – xx3004 Apr 1 at 1:20 @xx3004 You don't need background page for this, just declare your dictionary.

Js as a content script in the manifest and it will be automatically included when new tab is created, url is changed, etc. – serg Apr 1 at 2:50 Got you, I shouldn't have put it in background.html. Thank you very much! X – xx3004 Apr 2 at 0:43.

You can detect new tab creation by adding a listener to the onCreated event. You can detect the url change of the tab by adding a listener to the onUpdated event.

Thanks for your help! I think I should use the content script declaration. But this maybe useful for some other thing :P.

Again, thank you. X – xx3004 Apr 2 at 0:44.

Just add this on your background. Js : chrome.tabs.onUpdated. AddListener(function(tabId, changeInfo, tab) { insertDictionaryScript(); }); chrome.tabs.onCreated.

AddListener(function(tabId, changeInfo, tab) { insertDictionaryScript(); }).

Thanks for your help! Very clearly! I think I know what to do now.

X – xx3004 Apr 2 at 0:45.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions