Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

158
Views
Window properties becomes undefined

This is a very general question. Sadly I cannot provide you with any code sample that could help to shed some light on this particular issue.

I have quite a complex script that works with window objects (main window or window from iframes). I store them to variables and work with them later.

This script has an error logging mechanism. It tries to catch all possible errors (unhandledrejection and error events) and sends them via beacon API to the backend service.

It works just fine for most of the users but I can see sometimes these types of logs.

currentWindow.removeListener is not a function
element instanceof currentWindow.HTMLElement - the right-hand side of 'instanceof' is not an object

currentWindow is just a variable I store when script loads. (const currentWindow = window). I am pretty sure the window object doesn't get altered from the user in any way and the window variable I store is not overwritten.

To me, it seems that window properties are getting cleared. I suspect it happens when the tab is (force) closed. I tried many things to replicate -- CPU throttling, force closing chrome etc.) I have literally no clue why it happens and cannot find any related info here or on google.

I should also note that it is not some issue with old browsers. It happens in the newest version of chrome as well as firefox.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!