You can use axios library to fetch the image and get the response url :

let randomURL = 'https://source.unsplash.com/random/1920x1080/?wallpaper,landscape';

axios.get(randomURL).then( data => {
  // the url of the random img
  console.log(data.request.responseURL);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.19.0/axios.min.js" integrity="sha256-S1J4GVHHDMiirir9qsXWc8ZWw74PHHafpsHp5PXtjTs=" crossorigin="anonymous"></script>

and with vanilla JS :

fetch("https://source.unsplash.com/random/1920x1080/?wallpaper,landscape").then( data => {
	console.log(data.url);                
});

and if you want to support old browsers :

request = new XMLHttpRequest();
request.open("GET", "https://source.unsplash.com/random/1920x1080/?wallpaper,landscape", true);
request.send(null);
request.onreadystatechange = function() {
	if (request.readyState === 4) {
		if (request.status === 200) {
			console.log(request.responseURL);
		}
	}
}

Answer from Simon Dehaut on Stack Overflow
🌐
Unsplash
unsplash.com › s › photos › html
Html Pictures | Download Free Images on Unsplash
Download the perfect html pictures. Find over 100+ of the best free html images. Free for commercial use ✓ No attribution required ✓ Copyright-free ✓
🌐
Educative
educative.io › answers › how-to-link-unsplash-images-in-html-and-css
How to link Unsplash images in HTML and CSS
<img src="https://source.unsplash.com/" alt="" width="300"> We also require an image ID to link a specific image from Unsplash. This can be achieved through the following steps: We click on the image that we want to link in the HTML code from ...
🌐
Unsplash
unsplash.com › s › photos › html-css
Html Css Pictures | Download Free Images on Unsplash
Download the perfect html css pictures. Find over 70 of the best free html css images. Free for commercial use ✓ No attribution required ✓ Copyright-free ✓
🌐
Sitecast
tutorials.sitecast.com › tutorials › how-to-code-images-using-unsplash
How To Code Images Using Unsplash. | Sitecast Tutorials
Did you know you can pull in high quality images from Unsplash through their source API? This is one sweet and quick way to put free beautiful images when coding your web pages.
🌐
DEV Community
dev.to › alexanie_ › how-to-link-unsplash-images-in-html-and-css-5dd5
How to link Unsplash Images in Html and CSS - DEV Community
March 5, 2023 - In this blog post, you will learn how to link images from Unsplash to your HTML or CSS stylesheet. Once your HTML tag has been created, paste the image url to the src attribute in your HTML code. Unspash requires a source keyword before the ...
🌐
CodePen
codepen.io › suquiya › pen › LygQaW
Unsplash Source Example
View Compiled HTML · Analyze HTML · Maximize HTML Editor · Minimize HTML Editor · Fold All · Unfold All · <div class="container"> <h1><a href="https://source.unsplash.com/">Unsplash Source</a> Example</h1> <div class="mark">This Pen is ...
🌐
Medium
medium.com › @alexanie_ › how-to-link-unsplash-images-in-html-and-css-72e9c395d090
How to link Unsplash Images in Html and CSS | by Alex Anie | | Medium
March 5, 2023 - In this blog post, you will learn ... the image `url` to the `src` attribute in your HTML code. Unspash requires a `source` keyword before the `unsplash.com`...
🌐
Unsplash
unsplash.com › developers
Unsplash Image API | Free HD Photo API
Everything you need to search, fetch, and insert beautiful Unsplash images directly into your application with a fully native UI. Available on Android and iOS. Every image URL returned by the API can easily be manipulated to dynamically adjust the dimensions, crop, and quality of the image in realtime. ... We maintain official libraries in JavaScript, PHP, and Ruby. Our community have also built popular libraries in Go, Python, Swift, and more.
Find elsewhere
🌐
GitHub
github.com › topics › unsplash
unsplash · GitHub Topics · GitHub
HTML · Star 1 · Use https://source.unsplash.com to get random images and display them in Vanilla HTML · unsplash html-css-javascript · Updated · Feb 22, 2023 · HTML · Add a description, image, and links to the unsplash topic page so that ...
🌐
Bluegalaxy
bluegalaxy.info › codewalk › 2018 › 02 › 14 › html-get-random-stock-images-web-page-using-unsplash-com
HTML: How to get random stock images on your web page using unsplash.com | Chris Nielsen Code Walk
February 14, 2018 - The website https://unsplash.com provides a free service that allows web developers to use random images of any size on their websites. All you have to do is place a URL like this in your HTML img tag, with the size of the image listed at the end of the URL. For example, this will produce a ...
🌐
Unsplash
source.unsplash.com
Source Unsplash
Everything you need to search, fetch, and insert beautiful Unsplash images directly into your application with a fully native UI. Available on Android and iOS. Every image URL returned by the API can easily be manipulated to dynamically adjust the dimensions, crop, and quality of the image in realtime. ... We maintain official libraries in JavaScript, PHP, and Ruby. Our community have also built popular libraries in Go, Python, Swift, and more.
🌐
Unsplash
unsplash.com › s › photos › html-code
Html Code Pictures | Download Free Images on Unsplash
Download the perfect html code pictures. Find over 100+ of the best free html code images. Free for commercial use ✓ No attribution required ✓ Copyright-free ✓
🌐
Unsplash
unsplash.com › s › photos › source
Source Pictures | Download Free Images on Unsplash
html · sources · nature · the source · random · source code · api · open source · url · water · coding · code · Dario Brönnimann · For Unsplash+ Download · Chastagner Thierry · Download · Arseny Togulev · Download · Artur Aldyrkhanov · Download · Casey Horner ·
🌐
Code with Mosh
forum.codewithmosh.com › html/css
HTML Layout Exersize - Unsplash Random Image Not Working - HTML/CSS - Code with Mosh Forum
The random image URL given in this exersize is not working 13- Exercises | Code with Mosh Here is the URL “You can set your image source to https://source.unsplash.com/collection/190727/800x600 to get a random image.”
Published   August 13, 2024
🌐
CodePen
codepen.io › traceofwind › pen › vRvdmz
Unsplash images API
View Compiled HTML · Analyze HTML · Maximize HTML Editor · Minimize HTML Editor · Fold All · Unfold All · <img src="https://source.unsplash.com/TCpfPxKPOvk/200x200" alt="scean"> <img src="https://source.unsplash.com/WLUHO9A_xik/200x200" alt="specific"> <img src="https://source.unsplash.com/random/200x200" alt="random"> <img src="https://source.unsplash.com/user/erondu/200x200" alt="user"> <img src="https://source.unsplash.com/200x200/?nature,water" alt="search terms"> <img src="https://source.unsplash.com/collection/190727/200x200" alt="collection"> <img src="https://source.unsplash.com/user/traceofwind/likes/200x200" alt="user likes"> !
🌐
Unsplash
unsplash.com
Beautiful Free Images & Pictures | Unsplash
Get Unsplash+ Worry-free LicensingCleared for all uses · Supported by · Microsoft Copilot · Your AI Companion ↗ · Promoted · Download · Mike Hindle · Download · Planet Volumes · For Unsplash+ Download · Nikita Pishchugin · Download · Tuan P. Download · Long Chung ·
🌐
Unsplash
unsplash.com › s › photos › html5
Html5 Pictures | Download Free Images on Unsplash
Download the perfect html5 pictures. Find over 21 of the best free html5 images. Free for commercial use ✓ No attribution required ✓ Copyright-free ✓
🌐
Earth Inversion
earthinversion.com › blogging › how-to-link-unsplash-images-directly-to-your-jekyll-blog
How to link Unsplash images directly to your jekyll blog - Earth Inversion
June 13, 2021 - Then you can structure your link by concatenating https://source.unsplash.com, gySMaocSdqs, and other requests if you want.
🌐
GitHub
github.com › unsplash › unsplash-source-js
GitHub - unsplash/unsplash-source-js: 🐮 A javascript wrapper for the Unsplash Source API
var photo = new UnsplashPhoto(); photo.fetch(); // => "https://source.unsplash.com/random"
Starred by 174 users
Forked by 19 users
Languages   JavaScript 100.0% | JavaScript 100.0%