Importing a word list

Hi,
I’m designing an online experiment in which a series of words from an external word list (.txt format) is presented. On PsychoPy, I am able to import the word list using the open, read, and close functions. However, in the online experiment, javascript seems to not be able to read a .txt file.
Is there a different code segment to import this word list to be presented on Pavlovia in javascript?

Thank you.

What are you wanting to do with these words? Can the file (renamed to .csv) just be used as the conditions file for a loop?

Thank you for your reply.
I will be randomly selecting a few of the words within the file to be displayed on the screen one at a time.
I have managed to make it work locally on my own system using .txt file. However, javascript seems to make errors when using the same functions of open, read, and close of a text file online.

I just got finished with this same issue. Look at this thread: Variables empty in online script (looping over dictionaries)

Some functions don’t translate from Python to JS, so you have to do some manual JS code. In that thread, they have pretty helpful explanations, a link to a very helpful Google doc, and a link to a code that works. I highly recommend downloading the PsychoPy version of that persons’ code and opening it in Builder to see exactly what they did.