window.location.search vs window.location.href

window.location.href
The href property sets or returns the entire URL of the current page.

window.location.search
The search property sets or returns the querystring part of a URL, including the question mark (?).

Suppose  our current page url is "http://www.example.com/p/online-html-editor?demoid=4545454545"
window.location.href is "http://www.example.com/p/online-html-editor?demoid=4545454545"
window.location.search is "?demoid=4545454545"


Demo

Comments

Popular posts from this blog

Gove confirms mandatory housebuilding targets for councils will be abolished in face of Tory rebellion – UK politics live

Kotak Mahindra Bank Recruitment 2022 Released for Graduate Candidates And Apply Online