The Code Developer

Check if the URL contains string in JQuery

How to Check if the URL contains string in JQuery

Use Window.location.href to take the url in javascript. it’s a property that will tell you the current URL location of the browser.

<script type="text/javascript">
$(document).ready(function () {
    if(window.location.href.indexOf("?string=thecodedeveloper") > -1) {
       alert("your url contains the ?string=thecodedeveloper");
    }
});
</script>