Reputation: 5
how would one take part of the current page's url and change just a couple letters of it? Assuming jQuery would be the way to go?
for instance:
clicking a button counts the number of gets the 19th and 20th character EN
of
www.papercuts.com/EN/boxes/mailingtubes.html
and changes it to DE
www.papercuts.com/DE/boxes/mailingtubes.html
Upvotes: 0
Views: 106
Reputation: 32691
germanURL = englishURL.replace(/papercuts.com\/EN\//, 'papercuts.com/DE/');
Simply use replace
to replace the papercuts.com/EN/
.
Upvotes: 0
Reputation: 9429
and redirects?
window.location = window.location.href.replace(/.com\/.{2}/, '.com/DE');
edit: all language support by anstosa
Upvotes: 2