Hi everyone!
I’m currently setting up my companies website on wix or at least im trying.
I’m giving basic info about my company,but provide information about our products through an external site not related to wix.
And that’s where the problem starts, this external site is going down every once in a while, due to server issues.
Therefore I tried to set up a code to check if the site is available or not, which looks something like this:
let myElement = $w(“horizontalMenu2”);
let elementType = myElement.type
if (“myElement”).onClick(event = $check_url)
$check_url = www.originalsite.com
$connection = fsockopen ($check_url, 80);
if (!$connection)
{
header( “refresh:5;url=http://example.wixsite.com/example” );
}
else
{
header( “refresh:5;url=http://www.orginalsite.com/” );
exit();
}
so basically I’m trying to check if the url works or rather responds and if not lead to an alternative site within my wixsite.
I hope somebody can help me with this, cause as you can see I’m a newby and this not working code took me about 2 hrs of work.
Many thanks in advance.