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

161
Views
¿Cómo puede usar una etiqueta de atributo para insertar una variable desde el almacenamiento local para ejecutar un script?

Tengo mi javascript almacenado en una variable de almacenamiento local como hackVariable definido a continuación. hackearVariable
empezar:
">document.querySelector('[onclick="Hackbutton()";]').click();<img src='notexist.png'
final:

Luego tengo este documento html con el objetivo de activar el botón de clic después de que hackVariable se haya colocado en el atributo alt de la etiqueta de imagen. El problema al que me enfrento es que el navegador interpreta el "como" en la variable hackVariable.

 <!DOCTYPE html> <html> <body> <p>This example uses the HTML DOM to try to click a button</p> <img src="winner.jpg" alt="hackVariable" width="100" height="100" > <button type="button" id="Hackbutton" onclik="DoSomethingCrazy()"> Click Me!</button> </body> </html>

Este es el resultado que obtengo

 <img src="winner.jpg" alt=" &quot;><script>document.querySelector('[onclick=*&quot;*Hackbutton()*&quot;*;]').click();</script><img src='notexist.png' width="100" height="132" >

esto es lo que quiero conseguir

 <img src="winner.jpg" alt=" "><script>document.querySelector('[onclick="Hackbutton()";]').click();</script><img src='notexist.png' width="100" height="100" >

Mi objetivo es tratar de evitar que el navegador codifique la comilla doble "procedente de la variable en" Intenté algunos métodos como reemplazar "con &x22 or &#34 ; pero no funcionó.

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!