fozuse
fozuse

Reputation: 784

How can i get path without base href?

Base assigned in html like this:

<base href="http://root/tempop/panel/"/>

Current browser URL is:

http://root/tempop/panel/about/1

And i want this:

 about/1

How can i get?

Upvotes: 0

Views: 285

Answers (2)

user733421
user733421

Reputation: 497

var base = $("base").prop("href");
var fullurl = "http://root/tempop/panel/about/1"
var path = fullurl.replace(base,"");
console.log(path)

http://jsfiddle.net/57gbetwp/

Upvotes: 1

J. Titus
J. Titus

Reputation: 9690

var endPiece = document.location.href.split('http://root/tempop/panel/')[1];

Upvotes: 1

Related Questions