let url = '/#/detailsPage?id=132&orderNo=20190612153334146330519762640185'; if (url.indexOf('/#/detailsPage') > -1) { let index = url.indexOf('?'); console.log(index); console.log(url.substring(index, url.length)); } let name = 'id'; let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)'); let r = '?id=132&orderNo=20190612153334146330519762640185'.substr(1).match(reg); if (r != null) { console.log(unescape(r[2])); }