0

I have to create a chrome extension with a draggable view, which means you can click and hold the extension's interface to move it around the webpage and place it wherever you prefer.

Here's my manifest.json:

{
  "manifest_version": 3,
  "name": "Chrome extension",
  "description": "React Chrome Extension",
  "version": "1.0.0",
  "action": {
    "default_popup": "index.html",
    "default_title": "Open"
  },
  "permissions": [
    "scripting"
  ]
}

This allows me to click on the extension and have the index.html appear as the popup.

Everything I've tried uptil now is making the content inside the popup draggable, not the popup itself.

I'm a newbie and honestly not sure where to even start to make the popup draggable (or if its even possible to).

How can I add the funtionality to drag this around on whichever webpage I click the extension on? TIA!

Lin Du
  • 88,126
  • 95
  • 281
  • 483
  • Don't use default_popup. Use chrome.action.onClicked in your `service_worker` script and insert the UI into the web page as a DOM element ([example](https://stackoverflow.com/a/70870192)), then enable dragging using the standard web methods, see examples around. An alternative is to use `chrome.sidePanel` instead of a popup. – wOxxOm Jul 26 '23 at 12:05
  • [Create a detached/attached window toggle button for Chrome extension](https://stackoverflow.com/questions/74997351/create-a-detached-attached-window-toggle-button-for-chrome-extension) – Thomas Mueller Jul 26 '23 at 12:36

0 Answers0