Hi, it's not possible to use your api from javascript in browser.
I just want to load some random wallpaper
as example chrome dev console: fetch("https://wallhaven.cc/api/v1/search?seed=mQkrgy")
But browser blocks it
Access to fetch at 'https://wallhaven.cc/api/v1/search?seed=mQkrgy'
from origin 'https://novelfull.com'
has been blocked by CORS policy:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
If an opaque response serves your needs,
set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
As I know some services provide endpoint , which redirected to image itself. And this endpoint not blocked by cors.
https://random.imagecdn.app/1920/1080 https://random.danielpetrica.com/api/random https://api.nekosapi.com/v4/images/random/file e.t.c.
It's possible to include this to css without any json parsing. div.style.background = 'background: url("https://random.imagecdn.app/1920/1080")'
But I can't find way to do such things with your site. Only disabling browser cross domain policy, which leads to vulnerability.