Hiding images that failed to load

前端 未结 4 2001
执笔经年
执笔经年 2021-02-01 23:09

I have an Android application that generates some HTML which is rendered locally, in a Webkit view.

The details of the HTML generation aren\'t really that important exce

4条回答
  •  北海茫月
    2021-02-01 23:17

    Interesting question.

    Looking in Firefox, if an image doesn't load, its naturalHeight (and width too) is 0. You could probably use some javascript in android to read a similar property. My test script in Firebug was simply:

    document.getElementsByTagName('img')[0].naturalHeight
    

提交回复
热议问题