Select Page

You just need to add follwing script to the if else statement in JavaScript to know that the loaded page URL has the given string. You can use it anywhere in head or body tag, on or without document load.

<script>
    if ( window.location.href.indexOf("your-string") > -1 ) {

        alert('Yes this URL has the given string');
    }
</script>