1

Default position:

When I checked:

Then I click anywhere on the page to hide the output of dom extension(not show popup.html);

But when I open extension again it is unchecked(default position):

enter image description here

I need that chrome extension not reset to default position every time when I open it.

Maybe I need to use some property in manifest.json or not?

manifest.json:

 {
"version": "0.0.1",
"author": "a",
"short_name": "b",
"update_url": "https://clients2.google.com/service/update2/crx",
"description": "a",
"manifest_version": 2,
"name": "a",
"browser_action": {
    "default_popup": "popup.html",
    "default_title": "abc"
},
"permissions": [
"activeTab",
"cookies",
"clipboardWrite",
"storage",
"background",
"<all_urls>",
"tabs"
]

}

subUser
  • 77
  • 1
  • 9

1 Answers1

1

The popup is a regular page that is closed when you click outside it. Like for regular pages, any state within it is lost when the tab closes.

You should store it when the checkbox changes (via chrome.storage.local.set()) and restore it when the popup is opened again (chrome.storage.local.get())

Or use a regular popup so that it doesn't close automatically, if you prefer that behavior.

fregante
  • 29,050
  • 14
  • 119
  • 159