minlare minlare - 1 year ago 113
Javascript Question

<picture> src (active source)

Is there a way to retrieve a

element's currently used source in javascript without using the viewport width / pixel density?

Something similar to

Can anyone shed any light on this?

Answer Source

The <picture> element is still experimental so I do not think there is an API to get the "active" source yet. I did however find the following issues for the <picture> spec expecting the element to have a currentSrc element.


currentSrc is the behaviour I also would have expected but currently it is simply not implemented in Chrome or FireFox.

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