简体   繁体   中英

Calling a variable from a function in a different JS file

I am working on a chrome extension and I am stuck. I am not sure if this is even possible but this is what I need to have done. Basically the user click on the chrome extension and panel opens up (popup.html). The user is shown a list of images from the web and the user can select the ones they want to edit. popup.html loads popup.js. popup.js contains functions and inside those functions are some variable. Now there is a button in popup.html that takes you to another panel called filters.html. This is where editing goes. I am trying to pass the selected images from popup.html to filters.html and I am trying to call that array of images that was gathered in popup.js when popup.html loaded but its null. What is wrong is this even possible? When a new html page opens up does that mean it loses track of what happened in the last html page and therefore it loses also track of whatever .js files ran in that same page?

A new and better way is to use chrome extension storage . You can store the data from one page and u can read it in other page as data will be stored in chrome itself. Hope it helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM