I am using window.location.href.indexOf to check if URL contains a string and works very well for something like this:
if (window.location.href.indexOf("franky") > -1) {
alert("your url contains the name franky");
But it doesn't work to check if URL contains any number. The following always calls the alert, even if no number is in the URL.
if (
window.location.href.indexOf("0") === -1 ||
window.location.href.indexOf("1") === -1 ||
window.location.href.indexOf("2") === -1 ||
window.location.href.indexOf("3") === -1 ||
window.location.href.indexOf("4") === -1 ||
window.location.href.indexOf("5") === -1 ||
window.location.href.indexOf("6") === -1 ||
window.location.href.indexOf("7") === -1 ||
window.location.href.indexOf("8") === -1 ||
window.location.href.indexOf("9") === -1
)
{ alert("false"); }