I have a switch statement which handles URLs. I'm looking to include "#xyz" at the end of the URLs without having to create new cases for each additional URL.
switch(window.location.href)
{
case "mywebsite.com/blog":
case "mywebsite.com/blog#intro":
case "mywebsite.com/blog#sources":
case "mywebsite.com/blog#contact":
do something...
break;
case "mywebsite.com/home":
case "mywebsite.com/blog#about":
case "mywebsite.com/blog#email":
case "mywebsite.com/blog#contact":
do something...
break;
}
Should ideally be:
switch(window.location.href)
{
case "mywebsite.com/blog*":
do something...
break;
case "mywebsite.com/home*":
do something...
break;
}