Javascript Get Href.replace The Middle String
my url is http://localhost:8080/?usrType=t#52773890547536126 i want output as httplocalhost808052773890547536128 i have tried this in javascript config.channel = config.channel ||
Solution 1:
You need to replace everything between ?
and #
in addition to removing all those special characters.
config.channel = config.channel || location.href.replace(/\?.*?#|[\/:#%.\[\]]/g,'');
You can use the character set [\/:#%.\[\]]
instead of all those single-character alternatives.
Post a Comment for "Javascript Get Href.replace The Middle String"