How to check if url contains string

If you want to check if the current url contains a string use window.location.href.indexOf Here is a simple example which checks if the current url contain wthe world category. $(document).ready(function () { if(window.location.href.indexOf(“category”)...