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

84
Vistas
How to change path / src inside the iframe dynamically?

As you can see if you run the code snippet. You will see "openstreetmap" hyperlink.

If you click it. you will open a new document with a different URL path at the browser level. I want to get this new "URL" / "path" / document inside the iframe tag.

I have been trying to find a solution in many places. but it seems like an impossible mission!

can some brave guy, help me to do some magic in js / jquery. I was trying with sandbox attribute to prevent top navigation. but it feels like nothing is working.

Thanks!

<iframe 
src="https://www.openstreetmap.org/export/embed.html?bbox=-0.004017949104309083%2C51.47612752641776%2C0.00030577182769775396%2C51.478569861898606&layer=mapnik">
</iframe>

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

0

The target of <a> should have the name of the <iframe>:

<p><a href="https://www.openstreetmap.org/export/embed.html?bbox=-0.004017949104309083%2C51.47612752641776%2C0.00030577182769775396%2C51.478569861898606&layer=mapnik" target="map">Open map</a></p>
<iframe name="map"></iframe>

You can also use JavaScript:

document.querySelector('a').addEventListener('click', e => {
  e.preventDefault();
  document.querySelector('iframe').src = e.target.href;
});
<p><a href="https://www.openstreetmap.org/export/embed.html?bbox=-0.004017949104309083%2C51.47612752641776%2C0.00030577182769775396%2C51.478569861898606&layer=mapnik">Open map</a></p>
<iframe></iframe>

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