Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Get the base URL

const getBaseURL = url => url.replace(/[?#].*$/, '');

getBaseURL('http://url.com/page?name=Adam&surname=Smith');
// 'http://url.com/page'
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #Get #base #URL
ADD COMMENT
Topic
Name
9+4 =