“JS URL PathName” Código de respuesta

JavaScript obtenga ruta de URL

window.location.pathname
TC5550

JS URL PathName

var getLocation = function(href) {
    var l = document.createElement("a");
    l.href = href;
    return l;
};
var l = getLocation("http://example.com/path");
console.debug(l.hostname)
>> "example.com"
console.debug(l.pathname)
>> "/path"
Shadow

Js obtiene camino de la URL

var reg = /.+?\:\/\/.+?(\/.+?)(?:#|\?|$)/;
var pathname = reg.exec( 'http://www.somedomain.com/account/search?filter=a#top' )[1];
Borma

Respuestas similares a “JS URL PathName”

Preguntas similares a “JS URL PathName”

Más respuestas relacionadas con “JS URL PathName” en JavaScript

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código