How to check if the URL contains a given string
How could I do something like this:
[removed]
$(document).ready(function () {
if[removed].contains("franky")) // This doesn't work, any suggestions?
{
alert("your url contains the name franky");
}
});
[removed]
To check if the URL contains a given string you can use indexOf like this:
if[removed].href.indexOf("franky") != -1){....}
Also notice the addition of href for the string otherwise you would do:
if[removed].toString().indexOf("franky") != -1){....}