Get actual image url after redirect

Viewed 5418

Hi Unsplash allows to load random image from their website via:

https://source.unsplash.com/random/2560x1440

if I access the url from the browser each time the url generates random static image eg:

https://images.unsplash.com/photo-1488616268114-d949a6d72edf?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&cs=tinysrgb&w=2560&h=1440&fit=crop&s=a7f66c8417bcf79d2503b84db64c7b1a

I would like to request the image in jquery or js via the first url and in response get the second one. Is this possible?

4 Answers
fetch('https://source.unsplash.com/random').then(res=>{console.log(res)})

from source worked for me.

Related