0

I've got quite a simple task. On one of websites I need to get local storage data and for now just display it in my extension widget. That is a screen from popup.html which represents the UI of the extension. With red color I show div block where I would like to display data from Local Storage

enter image description here

That is the screen of function which takes data from Local Storage and should insert it in the div

[enter image description here

And this is the error I get when I try to display data

[enter image description here

Project in general project content popup.html popup.js

Could somebody explain where I miss something? Thanks in advance!

  • The error says you need to define `textField` variable. Note that the popup is a separate window so it has its own separate devtools: right-click inside the popup and select "inspect" in the menu. – wOxxOm Jul 19 '22 at 06:46
  • Thank you for fast reply, but it’s defined in popup.js at the very top( – Филипп Бехер Jul 19 '22 at 07:00
  • Judging by the error it is not defined correctly. Please show the code properly as text. – wOxxOm Jul 19 '22 at 07:16
  • added screens of the project – Филипп Бехер Jul 19 '22 at 08:46
  • executeScript runs the code in the web page, which is not related to the popup page so it can't access variables or elements of the popup page. You should separate the code that runs in the web page from the code that uses the result. Example: [How to access the webpage DOM rather than the extension page DOM?](https://stackoverflow.com/a/67227376) – wOxxOm Jul 19 '22 at 09:05

0 Answers0