Get The Parts Of A URL In JavaScript
JavaScript
const urlString = "https://some-user:some-password@www.example.com:80/some/path?alfa=bravo&charlie=delta#after-the-hash";
const url = ;
// #after-the-hash
// www.example.com:80
// www.example.com
//
// https://some-user:some-password@www.example.com:80/some/path?alfa=bravo&charlie=delta#after-the-hash
//
// https://www.example.com:80
//
// some-password
//
// /some/path
//
// 80
//
// https:
//
// ?alfa=bravo&charlie=delta
//
// { alfa => "bravo", charlie => "delta" }
//
// some-user
//
-- end of line --