2

I'm developing a chrome extension, popup.html saves some data into extension's local storage (key:viewMode value:WYSIWYG)

When I'm trying to retrieve the data using Chrome Storage API from script.js, it says that viewMode is undefined.

Here is manifest.json

{
    "manifest_version": 2,

    "name": "LoremIpsum",
    "description": "Dolor sit amet",
    "version": "1.2.8",

    "permissions": [
        "http://*.exemple.org/*",
        "storage"
    ],

  "browser_action": {
    "default_icon": {
      "19": "icons/19.png"
    },
    "default_title": "LoremIpsum",
    "default_popup": "popup.html"

    "icons": {
        "16": "icons/16.png",
        "19": "icons/19.png",
        "48": "icons/48.png",
        "128": "icons/128.png"
   },

   "web_accessible_resources": [
    "img/*.png",
    "smilies/*.gif",
    "style.css"
  ],

    "content_scripts": [
        {
            "matches": ["http://*.exemple.org/*showtopic*", "http://*.exemple.org/*act=ST*"],
            "css": ["style.css"],
            "js": ["jquery-1.10.2.min.js", "popup.js", "script.js"] 
        }
    ]
}
grg
  • 5,023
  • 3
  • 34
  • 50
Slev7n
  • 343
  • 3
  • 14
  • 1
    We are going to need the js files as we'll. – Teepeemm Feb 16 '14 at 21:08
  • @Teepeemm Here it is `code`chrome.storage.local.get("viewMode", function(data) { alert(data.viewMode); }); – Slev7n Feb 16 '14 at 21:50
  • I assume this is `script.js`? Could you edit your post and put that and `popup.js` in there? – Teepeemm Feb 16 '14 at 23:25
  • @Slev7n How are you adding data to localstorage via popup. Need your help on this. http://stackoverflow.com/questions/21818105/chrome-storage-local-set-doesnt-save-data-locally –  Feb 16 '14 at 23:38

1 Answers1

1

I just realized that I made a dumb error while setting chrome.storage.local. I've passed arguments as an array instead of passing them as an object.

Slev7n
  • 343
  • 3
  • 14