P
P
Pasha2014-05-18 13:30:58
Browser extensions
Pasha, 2014-05-18 13:30:58

executescript not working

Hello. Tell me why executeScript does not work in the google chrome extension?
Manifest

{

  "manifest_version" : 2 , 
  "name" : "vkBookmarks" ,
  "description" : "bookmarks for vk" ,  
  "version" : "1.0" , 

  "permissions" : [
    "tabs", "http://*/*", "https://*/*",  
    "storage"
  ], 
  "background" : {
    "scripts" : [
      "bg.js"
    ]
  }
  
}

Code
chrome.tabs.onActivated.addListener(function(data) {
  chrome.tabs.executeScript(null, {
    	        code: 'document.body.style.backgroundColor="red"'
   	});
}) ;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Solovyov, 2014-05-18
@korovnikiss

you need to specify tabId as the first parameter

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question