Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

254
Vistas
window.opener reference lost in Firefox

Consider the following case:

  • Step 1: Website A opens Website B in a new tab (At this point Website B has its opener window reference i.e Website A window object in window.opener).
  • Step 2: Website B redirects to Website C (We have window.opener referencing Website A window here too).
  • Step 3: Then Website C performs some authentication and redirects back to Website B. At this step 3 the window.opener has the reference of the current window object i.e window object of Website B itself (window.opener === window) and we’ve lost reference to the original opener (i.e Website A window object). We need the window.opener object for communicating with Website A using postMessage.

Visual reperesentation of steps

Note: We don’t have control over Website C and can’t control how they’re redirecting back to Website B. Also this is happening only on Firefox/Safari. On Chrome we're able to get the original opener reference after redirections.

In case Website C is redirecting with rel=noopener the window.opener should be null (Reference from MDN). I’m not able to understand in which case the window.opener can be the current window object and why it is happening on Firefox/Safari but not on Chrome? And is there anything we can do anywhere except Website C to prevent this?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

This is possible in firefox and Safari, window.opener can be current window when you add target _self. If you do window.open('someurl', '_self') then window.opener will be current window and will open in same tab instead of a new tab. This only happens in safari and firefox(from what i have observed). All chromium based browsers don't change the original window opener in any case.

I don't know the exact reason why safari and firefox handles it this way I tried to find the reason but can't find it.

I faced this issue once and the solution which we did was to ask website C to use either window.location.replace or window.location.href to redirect back to website B so they open website b in same tab.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda