Welcome guest, is this your first visit? Create Account now to join.
Results 1 to 2 of 2

This is a discussion on chrome.tabs.executeScript failed? Chrome won't run content script within the Plugins Development section, part of the Chrome Plugins category: Hi there, Thanks for your help. I'm new to js and chrome extension. This should be a simple problem but ...


  1. #1
    yuanye is offline Junior Member
    Join Date
    Jul 2011
    Posts
    1

    Default chrome.tabs.executeScript failed? Chrome won't run content script

    Hi there,

    Thanks for your help. I'm new to js and chrome extension.
    This should be a simple problem but I'm having a hard time figuring it out =(.

    So in my background.html, I have
    Code:
      // execute content script when the extension's icon is clicked
      chrome.browserAction.onClicked.addListener(function(tab) {
        chrome.tabs.executeScript(tab.id, {file: "extractFieldsContentScript.js"});
      });
    in extractFieldsContentScript.js, I have
    Code:
    var title;
    var url;
    var body;
    
    
    function extractFields() {
      title = document.title;
      url = document.url;
      body = document.body;
      console.error("in script");
    }
    
    
    extractFields();
    chrome.extension.sendRequest(
        {title: title, url: url, body: body},
        function(response) {
          console.log(url + response.status);
        });
    The problems are
    1. chrome not displaying the content script under "Developer Tools -> Scripts". This makes it impossible to debug the content script. Is this supposed to happen?
    2. The script is not executed.
    Code:
    console.error("in script");
    has no effect. Instead I see
    chrome/ExtensionProcessBindings:96 Error during tabs.executeScript: Unknown error.

    Please help! Thanks!
    Last edited by yuanye; 07-14-2011 at 11:41 PM.

  2. #2
    ioriliao is offline Junior Member
    Join Date
    Sep 2011
    Posts
    5

    Default

    please show your all files.you have a QQ?my QQ:82530662please add me.or mail to me:82530662@qq.comchinese:请把你所有的文件上传来。 你有QQ吗? 我的QQ是:82530662或者发到我邮箱:82530662@qq.com

Similar Threads

  1. How to debug content script?
    By alex82 in forum Plugins Development
    Replies: 6
    Last Post: 07-21-2012, 03:45 PM
  2. content script help
    By crackruckles in forum Plugins Development
    Replies: 7
    Last Post: 02-19-2010, 04:31 AM
  3. Content Script Issues
    By hexid in forum Plugins Development
    Replies: 2
    Last Post: 12-15-2009, 03:37 PM
  4. Stuck with content script...
    By rohit in forum Plugins Development
    Replies: 1
    Last Post: 12-15-2009, 03:19 PM
  5. content script problem..
    By Gaurang033 in forum Chrome Plugins
    Replies: 0
    Last Post: 06-01-2009, 10:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •