abdel diwat
abdel diwat

Reputation: 41

how to delete a part of urls using javascript

I wanna know how to delete a part of urls using javascript here's an example :

1.bp.blogspot.com/-gAOB6nWGgT0/Vtmbryn-e-I/AAAAAAAAWG0/jE5iiKmzi0Q/**s72**-c/imga0343.jpg

2.bp.blogspot.com/-zO5IrZEk-ck/VthrVoL0H4I/AAAAAAAARBw/LvQFWENcVB0/**s72**-c/s7e.jpg

3.bp.blogspot.com/-dfwIePlSYWw/Vtl5w0YqmBI/AAAAAAAARC8/BOeebRHZWzA/**s72**-c/facema.jpg

I wanna delete this part of urls :**s72**

Upvotes: 0

Views: 37

Answers (1)

kennasoft
kennasoft

Reputation: 1593

I don't know what you scenario is, but If you just want to delete the s72 from the url and use it elsewhere, it's as easy as

javascript:

var url = window.location.href;
var newUrl = url.replace(/\/s72-/, "/-");
//then if you want to navigate to the new url,
window.location.href = newUrl;

Upvotes: 1

Related Questions