JQuery Sprawdź, czy adres URL zawiera ciąg
//If URL contains "mystring"
if (window.location.href.indexOf("mystring") > -1) {
}
Ugly Unicorn
//If URL contains "mystring"
if (window.location.href.indexOf("mystring") > -1) {
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
if (window.location.href.indexOf("franky") > -1) {
alert("your url contains the name franky");
}
});
</script>
var reg = new RegExp('([a-zA-Z\d]+://)?((\w+:\w+@)?([a-zA-Z\d.-]+\.[A-Za-z]{2,4})(:\d+)?(/.*)?)', 'i')
if (reg.test(status_text)) {
alert(reg.exec(status_text)[2]);
}