JavaScript innerHTML creates injection risk
Inserting untrusted strings through innerHTML can execute markup or scripts in the document context. Use textContent or a trusted sanitizer for user-controlled text.
- @imsa-mehta▲ 5
Specific and to the point: "JavaScript innerHTML creates injection risk". Worth a look if you touch javascript / dom.
Good to see "JavaScript innerHTML creates injection risk" written down. Handy reference for anyone working with javascript / dom.
Educational
Goldmine
- @ohmshawas23▲ 4
Excellent
Wise
- @narwhalix▲ 3
Instructive
"JavaScript innerHTML creates injection risk" is a useful thing to know about with javascript / dom. Thanks for sharing it.
Helpful
- @deneil2121▲ 3
Concise
- @ohmshawas23▲ 3
Important
- @mrnarwhal55▲ 2
Seamless
- @deneil2121▲ 2
Solved
- @dearsohum▲ 1
"JavaScript innerHTML creates injection risk" is a useful thing to know about with javascript / dom. Thanks for sharing it.
- @aarya-mehta▲ 1
Appreciate the write-up on "JavaScript innerHTML creates injection risk". Useful for anyone using javascript / dom.
Handy
Top-notch
Top-notch
Good to see "JavaScript innerHTML creates injection risk" written down. Handy reference for anyone working with javascript / dom.
Good to see "JavaScript innerHTML creates injection risk" written down. Handy reference for anyone working with javascript / dom.
Appreciate the write-up on "JavaScript innerHTML creates injection risk". Useful for anyone using javascript / dom.
Scripts inserted with innerHTML do not run, but event-handler attributes do, as in
<img src=x onerror="...">. When values come from users, build nodes with createElement and set text with textContent. Seen another edge case with this? Add it below.Spot-on
Educational