Stand Coder Stand Coder - 1 year ago 103
Javascript Question

How to send http request on img tag's onerror attribute?

I've tried as follows, but it doesn't work

<img src=a onerror="document.write('<img src=\"\">')">

Answer Source

\ is not an escape character in HTML.

To put a " character inside an attribute value delimited with " characters, you must represent it as an entity. e.g. &quot;.

Keep in mind that cross-origin restrictions prevent load and error events firing on images srced from a different origin.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download