469,631 Members | 1,776 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,631 developers. It's quick & easy.

How to find and replace current URL

Hi,
I've got some code that changes the current URL Domain of .com to another URL Domain, such as .co.uk. I'd like it to change any URL Domain (.com, .fr, .de etc) to .co.uk, and not only .com.
My current code is:
Expand|Select|Wrap|Line Numbers
  1. if (myVolume == '.co.uk') {
  2.             event.target.browserWindow.activeTab.url = currentURL.replace(/\.com/ig, ".co.uk");
  3.     }
If it can be altered slightly, great! :)
Thanks,
Joseph Duffy
Oct 23 '10 #1
1 1586
gits
5,390 Expert Mod 4TB
you might extend the regExp like:

Expand|Select|Wrap|Line Numbers
  1. /\.com$|\.it$/ig
Oct 27 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Peter Royle | last post: by
6 posts views Thread by ritagoldman101 | last post: by
reply views Thread by Tim::.. | last post: by
8 posts views Thread by None | last post: by
1 post views Thread by Sajjad Akhter | last post: by
4 posts views Thread by pedestrian via DotNetMonster.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.