Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Chrome Extension manifest_version 2 update problem

JSON

  • Please log in to reply
1 reply to this topic

#1 stealthtranslations

stealthtranslations

    CC Lurker

  • Just Joined
  • Pip
  • 2 posts
  • Programming Language:Java, PHP, JavaScript
  • Learning:PHP, JavaScript

Posted 10 October 2012 - 07:42 AM

Recently, Google updated the Chrome version whereby manifest for any Chrome Extension script has now to be;

manifest_version: "2.0"


We have a script which pulls information from a spreadsheet and creates an email template filling in the various information from the Google spreadsheet in the new email. Since the update to manifest_version: "2.0" we have been unable to make this script operate correctly.

When updating to manifest version 2 you must ensure that your manifest.json uses the correct code as some of the code from manifest version 1.0 has been updated. We have changed code such as;

- including 'manifest_version: "2.0"
- changing 'popup': 'popup.html' to 'default_popup': 'popup.html'
- transferring any inline javascript in the popup.html file to be run externally

Below is the code from the manifest;

{
  "name": "POTool",
  "description": "Google spreadsheet -> Gmail transfer PO data",
  "version": "2.0",
  "manifest_version": 2,
  "permissions": [
    "tabs",
    "https://docs.google.com/*",
    "https://mail.google.com/*"
  ],
  "background": {
"script": "background.html"
  },
  "browser_action": {
    "default_icon": "icon.png",
    "default_popup": "popup.html"
  },
  "content_scripts" : [
    {
	  "matches": ["https://docs.google.com/spreadsheet/ccc?key=[key removed]",
				  "https://spreadsheets.google.com/*"],
"js": ["content_script.js"]
    }
  ],
  "options_page": "options.html"
}

I've removed the key for security purposes.

The process when the script worked was;

1. We clicked an icon beside the address bar
2. A user prompt appears asking us to select which row from the spreadsheet we wished to process
3. A new email would open up in a new window
4. All the data from the spreadsheet is incorporated in an email template


The process at the moment is;

1. We click an icon beside the address bar
2. A user prompt appears asking us to select which row from the spreadsheet we wish to processs
3. Nothing else happens.



Thanks in advance for your help.
  • 0

#2 wim DC

wim DC

    Roar

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 2681 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Python

Posted 11 October 2012 - 11:07 PM

When you are at step 3: nothing else happens. Press CTRL+shift+J and see if you're getting errors.

I don't think the extension would load if there's an error in the manifest.

Know you can always debug your extension's javascript code. Open a page which matches your 'matches' rule. Then press F12 Go to the sources tab.
Click on "content scripts" on the left. You likely have to press F5 now.

Now you probably see a few items in the list with random names like "jpfegmkjdsbmksfjl" or "mdslfkbfseofesa" and the like. Just open the tree, and 1 of those things will have content_script.js in there. From there you can debug line per line.
  • 0





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download