img onerror does not seem to be working to show alternative image if the src does not work

24 views
Skip to first unread message

mic...@mobiledataanywhere.com

unread,
Jun 7, 2016, 2:10:39 AM6/7/16
to wkhtmltopdf General
I am trying to display an alternate image in an img tag using the onerror handler and in line javascript. It works in Chrome but not using wkhtmltopdf.

Below is an example from the attached example.

<img width="180px" src="" alt="Image not found" onError="this.onerror=null;this.src='AE754834-75E9-4909-A8EE-A39940BFE378_Photo2_2016-06-07_12-04-22.jpg';" />

If src is empty then the onerror error should fire and replace the src with the image that is available.

Using wkhtmltopdf it just displays the 'Image not found' alt text.

In Chrome it displays the image found in AE754834-75E9-4909-A8EE-A39940BFE378_Photo2_2016-06-07_12-04-22.jpg.

Regards
Michael


AE754834-75E9-4909-A8EE-A39940BFE378.zip
Reply all
Reply to author
Forward
0 new messages