Prevent sidebar reloading when re-opening

Hi folks, are there any extension developers here? I've a question, not sure if it is possible.

I created a very simple extension which opens chatgpt in the sidebar. This works great, but the thing is, every time I open the sidebar, it refreshes the page. I don't want that, I'd rather it opens where I left off. Is there any way to accomplish this or is it a pipe dream? I'll post my code here:
manifest.json:

{

  "manifest_version": 2,
  "name": "ChatGPT Sidebar",
  "description": "Displays ChatGPT in sidebar.",
  "version": "1.0",
  "browser_specific_settings": {
    "gecko": {
      "strict_min_version": "54.0a1"
    }
  },

  "sidebar_action": {
    "default_icon": "icons/ChatGPT_logo.svg",
    "default_title" : "ChatGPT Sidebar",
    "default_panel": "sidebar/panel.html"
  },

  "permissions": ["tabs"],

  "commands": {
    "_execute_sidebar_action": {
      "suggested_key": {
        "default": "Alt+Shift+9"
      }
    }
  }

}

And the panel.html:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="refresh" content="0;url=https://chat.openai.com/" />
  </head>
<body></body>
</html>

[edit] formatting

6 points · 2 comments · view on lemmy.world

2 Comments

_HR_@lemmy.world · 3 pts · 3y (1 reply)

Is there any way to accomplish this or is it a pipe dream?

Dunno if that's possible in a way specific to extensions, but perhaps you could try to save the HTML of the page and load the saved page on sidebar opening/closing if nothing else works.

BTW, your post formatting could be fixed by using 3 consecutive ` on empty lines, like so:

 ```
    code
 ```
r2dj@kbin.social · 1 pts · 3y

I'm going to look into saving the HTML, thanks for the suggestion!