Below function may be useful for you for removing query string from URL and getting the URL Path only using JavaScript
function getPathFromUrl(url) {
return url.split(/[?#]/)[0];
}
or Minified Version
let getPathFromUrl =t=>t.split(/[?#]/)[0];
Example :-
let getPathFromUrl =t=>t.split(/[?#]/)[0];
var url = 'https://pngaaaclone.sh20raj.repl.co/?q=wallpaper&page=2?q=Nba%20Logo';
getPathFromUrl(url) //Output :- 'https://pngaaaclone.sh20raj.repl.co/' ;
Checkout a new WebScrapperJS + WhollyAPI Project
SH20RAJ / pngaaaclone
Pngaaa Clone Using WebScrapperJS and WhollyAPI
pngaaaclone
Pngaaa Clone Using WebScrapperJS and WhollyAPI
See Demo :- https://soppng.vercel.app/ | https://pngaaaclone.sh20raj.repl.co/ | https://sh20raj.github.io/pngaaaclone/
Demo on Blogger :- https://sop-png.blogspot.com/
Create Using WebScrapperJS
:- https://github.com/SH20RAJ/WebScrapperJS
See Dev.to Article :-
Β© SopProducts :- https://sh20raj.github.io/SopProducts/
Top comments (0)