Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I always get this error in Chrome's console.

Uncaught Error: chrome.tabs is not supported in content scripts. See the content scripts documentation for more details.

But everything works fine.

Anyone knows what is causing this and how I can solve it?

share|improve this question
add comment

migrated from stackoverflow.com Aug 8 '13 at 16:23

This question came from our site for professional and enthusiast programmers.

3 Answers

up vote 36 down vote accepted

Typically, the cause is a misbehaving extension. In my case it was "MeasureIt!". To identify, which extension is making troubles, you can either

deactivate them one by one and test

  1. deactivate all the extensions
  2. ensure the error is gone
  3. activate extensions one by one
  4. test if the error reappears, repeat from step 3

or

search their source code

  1. open chrome://extensions
  2. activate "Developer mode" in the top right corner
  3. now you can open background.html for every extension
  4. Ctrl+F, type in "chrome.tabs" to search for suspicious code spots
  5. give feedback to the extension creator
share|improve this answer
8  
Nice one :) Was 'Measureit!' for me also.. –  Eddie Sep 20 '11 at 10:32
    
Thanks so much. Measureit was my problem. –  Jake Feb 4 '12 at 17:52
add comment

You cannot use chrome.tabs in content scripts. According to the documentation,

...content scripts have some limitations. They cannot:

  • Use chrome.* APIs (except for parts of chrome.extension)
  • Use variables or functions defined by their extension's pages
  • Use variables or functions defined by web pages or by other content scripts

So, you can only use the chrome.tabs API in background pages or other extension pages. You can use extension message passing to request that a background page use chrome.tabs.

share|improve this answer
    
I don't get what is using chrome.tabs. Could it be one of my Chrome extensions? –  8k_of_power Aug 7 '11 at 9:39
3  
Yes, this error can only be thrown by a Chrome extension (as of now). –  Digital Plane Aug 7 '11 at 11:07
5  
For me, it was MeasureIt! causing the error. –  JustinBull Aug 24 '11 at 19:20
    
@weng If you still get the error, try disabling some extensions in groups and see if the error is removed. –  Digital Plane Aug 25 '11 at 4:24
    
MeasureIt! Also causing this error for. Can't be bothered to debug someone else's code so I'm just bearing with it for now. –  sw00 Sep 5 '11 at 12:29
add comment

This is caused by an extension using the chrome.tabs permission, but without specifying that it does so in the manifest.json packaged with the extension. The trick is not just to find the extension that uses chrome.tabs, but to find the one that does so without announcing it.

Start with a more automated approach (multi-line commands for readability): On *nix:

$ find . -type f \
> | xargs grep -l chrome.tabs \
> | cut -d '/' -f 2 \
> | uniq

On Windows, using PowerShell:

> gci -rec |? {-not $_.PSIsContainer} `
>> | sls 'chrome.tabs' `
>> | select -Unique Path `
>> |% {$_.Path.Split('\')[10] } `
>> | select -Unique
>>

Then go to the chrome://extensions tab to match directories in the results to extension names, and click the permissions of each one to see who isn't copping to their usage of chrome.tabs. Note that on the 4th line of the PowerShell snippet, I index '10' because that's how many path components there are from C:\ to the Extensions directory; it could be different on your system.

In my case, I fully automated the search by tacking on a couple more segments to the pipeline:

$ find . type f \
> | xargs grep -l chrome.tabs \
> | cut -d '/' -f 2 \
> | uniq \
> | xargs -I % find % -name 'manifest.json' \
> | xargs grep -L tabs
hipbfijinpcgfogaopmgehiegacbhmob/16.0.544_0/manifest.json
hipbfijinpcgfogaopmgehiegacbhmob/17.1_0/manifest.json
hipbfijinpcgfogaopmgehiegacbhmob/18.1_0/manifest.json

Now, looking in chrome://extensions:

enter image description here

Busted.

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.