Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

get last path segment of url in javascript

const last_segment = window.location.pathname.split('/').pop();
Comment

javascript get last url segment

console.log(this.href.substring(this.href.lastIndexOf('/') + 1));
Comment

PREVIOUS NEXT
Code Example
Javascript :: datatables clear table 
Javascript :: arraylist of characters 
Javascript :: javascript check if element has class 
Javascript :: python save list to json 
Javascript :: updating node js ubuntu 
Javascript :: history back js 
Javascript :: javascript change css float property 
Javascript :: create react project 
Javascript :: jquery when you typing in input 
Javascript :: set value javascript by id 
Javascript :: get last day of month typescript 
Javascript :: javascript get element height 
Javascript :: react toggle class 
Javascript :: setup new angular project 
Javascript :: javascript even mouseout 
Javascript :: jquery cdn cloudflare 
Javascript :: just number regex js 
Javascript :: import map in angular 
Javascript :: javascript change comma to dot 
Javascript :: useeffect with axios react 
Javascript :: js call function onload 
Javascript :: unique objects in array javascript 
Javascript :: update react app 
Javascript :: req.body is undefined 
Javascript :: logout in react js 
Javascript :: put form action jquery 
Javascript :: create element ns svg 
Javascript :: JSONStringify c# 
Javascript :: js remove dollar sign from string 
Javascript :: Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property. 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =