I am wondering if there’s a way to target an embed frame that links to a URL that doesn’t exist? For example, my embed links to a page that correlates to a day of the month, I’ve coded this in already. But some days don’t have a page developed for that specific day. I want to design a single empty state page for this occurrence, and want to use Velo to find when an iframe’s url is returning a 404 or error or whatever, and redirect the URL to the empty state URL. Any tips?
Here’s the current code:
$w.onReady(function () {
let path = "/meal";
//on page load, add the url slug and day of the month to the src field of the embed frame
{$w('#mealOfDay').src = 'https://www.mywixsite.com' + path + [new Date().getUTCDate()]; //adds "meal" + day of month to end of url
}
{
//disable scrollling
$w("#mealOfDay").scrolling = "no";
}
//set to fullscreen
{
$w("#mealOfDay").allowFullScreen();
}
})