# Online: win is undefined

**URL:** <https://discourse.psychopy.org/t/online-win-is-undefined/23352>\
**Category:** Online experiments\
**Created:** [June 4, 2021, 12:37pm UTC](https://discourse.psychopy.org/t/online-win-is-undefined/23352 "2021-06-04T12:37:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dtgm01](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@dtgm01](https://discourse.psychopy.org/u/dtgm01)\
**Post date:** [June 4, 2021, 12:37pm UTC](https://discourse.psychopy.org/t/online-win-is-undefined/23352/1 "2021-06-04T12:37:54Z")

</div>

Hi everyone,

I am piloting my experiment online and I keep getting the error message **win is undefined**.

In my _begin experiment tab_ I have the following code:

```auto
window.thisExp = psychoJS.experiment;
window.win = psychoJS.window;
window.event = psychoJS.eventManager;
window.shuffle = util.shuffle;
win = psychoJS.window;
thisExp = psychoJS.experiment;

```

I have tried running the experiment in both Firefox and Chrome, in Chrome I get the error message **TypeError: Cannot read property ‘\_psychoJS’ of undefined**.

Any advice on what I should try?

Cheers!

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [June 4, 2021, 2:00pm UTC](https://discourse.psychopy.org/t/online-win-is-undefined/23352/2 "2021-06-04T14:00:29Z")

</div>

That code isn’t the same as suggested on my [2020 crib sheet](https://docs.google.com/document/d/13jp0QAqQeFlYSjeZS0fDInvgaDzBXjGQNe4VNKbbNHQ/edit?usp=sharing), which is

```auto
thisExp=psychoJS.experiment;
win=psychoJS.window;
event=psychoJS.eventManager;
shuffle = util.shuffle;

```

---

<div class="post-metadata">

**Author:** ![dtgm01](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@dtgm01](https://discourse.psychopy.org/u/dtgm01)\
**Post date:** [June 7, 2021, 8:55am UTC](https://discourse.psychopy.org/t/online-win-is-undefined/23352/3 "2021-06-07T08:55:27Z")

</div>

Thanks Wake.

I have updated the _begin experiment tab_ with your code and I still get the **win is not defined** error message. Any ideas what else I could try?

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [June 7, 2021, 8:58am UTC](https://discourse.psychopy.org/t/online-win-is-undefined/23352/4 "2021-06-07T08:58:47Z")

</div>

Ctl-Shift-R to flush the cache and run the latest version of your experiment

---

<div class="post-metadata">

**Author:** ![dtgm01](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@dtgm01](https://discourse.psychopy.org/u/dtgm01)\
**Post date:** [June 7, 2021, 9:04am UTC](https://discourse.psychopy.org/t/online-win-is-undefined/23352/5 "2021-06-07T09:04:06Z")

</div>

Tried refreshing the page and I have manually cleared all my cookies and caches, but still the same error message in Firefox. Also tried it in Chrome but I still get the error message: **TypeError: Cannot read property ‘\_psychoJS’ of undefined**
