Answers for "get current url in javascript till /"

48

javascript get current url

var currentUrl = window.location.href;
Posted by: Guest on July-22-2019
0

get current url in javascript till /

// If URL is http://www.somedomain.com/account/search?filter=a#top

window.location.pathname // /account/search

// For reference:

window.location.host     // www.somedomain.com (includes port if there is one)
window.location.hostname // www.somedomain.com
window.location.hash     // #top
window.location.href     // http://www.somedomain.com/account/search?filter=a#top
window.location.port     // (empty string)
window.location.protocol // http:
window.location.search   // ?filter=a
Posted by: Guest on March-28-2022
0

Get the current URL with JavaScript?

window.location.href
As noted in the comments, the line below works, but it is bugged for Firefox.

document.URL
Posted by: Guest on March-15-2022

Code answers related to "get current url in javascript till /"

Code answers related to "Javascript"

Browse Popular Code Answers by Language