How can I remove and change some texts of a URL in an HTML using Javascript.
For example, I have this instagram photo in my HTML.
<img src="http://scontent-b.cdninstagram.com/hphotos-xaf1/t51.2885-15/10611172_606838796104009_200732638_s.jpg">
Then I want it to be linked automatically (via javascript) to it's larger image preview here: http://scontent-b.cdninstagram.com/hphotos-xaf1/10611172_606838796104009_200732638_n.jpg
Notice that the _s was changed to _n and the folder /t51.2885-15 was removed in the URL.
So basically I just want a javascript to remove the /t51.2885-15 and replace the _s with _n.
I think this can be achieved using javascript but I don't know why. Can this be easily written with a few lines of code? Or do you have other suggestions other than writing a javascript.