I have this url and I want to remove the "amp;" from it. Any ideas
http://localhost/projects/opencart/opencart230/upload/index.php?route=product/product&product_id=40
Consider working with URLs that do not feature HTML entities like &. If, for some reason, you cannot avoid them in your URLs, do the following to parse them:
const url = "http://localhost/projects/opencart/opencart230/upload/index.php?route=product/product&product_id=40";
const parseResult = new DOMParser().parseFromString(url, "text/html");
const parsedUrl = parseResult.documentElement.textContent;
console.log(parsedUrl);
You can use replace function
str = 'http://localhost/projects/opencart/opencart230/upload/index.php?route=product/product&product_id=40'
str.replace('&','&')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With