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

109
Vistas
Change window location href in subdomain iframe

I have a.example.com and b.example.com;

When I put b.example.com/foo as iframe in a.example.com:

<iframe src='b.example.com/foo'></iframe>`

the window.location.href value accessible from b.example.com is ... a.example.com/foo (??)...

The problem is - I use an external library in b.example.com/foo that checks for window.location.href and it gets incorrect information.

For this scenario it appears to me that I should iframe /foo content on a completely different domain like: anotherexample.com/foo, where the window.location.href would actually point to anotherexample.com/foo.

How can I force window object in iframe to actually use its subdomain instead of parent domain with added parameter?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Are you sure you are using your script in the right subdomain? it seems your external library is accessing parent window using window.parent.location, here is a code to check if a page is loaded directly or within another page:

var is_loaded_directly = (window.location == window.parent.location);

Since this code works, something is wrong on your setup or library.

Note: maybe you can solve your issue by checking document.location instead of window.location.

about 4 years ago · Juan Pablo Isaza 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