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

209
Vistas
href with "javascript" doesn't work in iframe

I have page.html where there is following code:

<iframe srcdoc="&lt;a href=&quot;javascript:console.log(1)&quot;&gt;test&lt;/a&gt;" sandbox="allow-same-origin || allow-scripts || allow-top-navigation || allow-popups"></iframe>

I allow scripts, top-navigation and popups. When I load page.html in browser(Firefox Lastest), I can see hyper-link test in iframe, but here is the problem: when I click it - nothing appears in console(F12) while following code:

<iframe srcdoc="&lt;script&gt;console.log(1)&lt;/script&gt;" sandbox="allow-scripts || allow-top-navigation || allow-popups"></iframe>

Outputs "1" in console. Why wouldn't the javascript in a href work?

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

0

  • You missed some code in your href (javascript:...)
  • allow-same-origin: If this token is not used, the resource is treated as being from a special origin that always fails the same-origin policy. see MDN doc here
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