How to find and replace current URL

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Joseph Duffy

    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:
    Code:
    if (myVolume == '.co.uk') {
    			event.target.browserWindow.activeTab.url = currentURL.replace(/\.com/ig, ".co.uk");
    	}
    If it can be altered slightly, great! :)
    Thanks,
    Joseph Duffy
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    you might extend the regExp like:

    Code:
    /\.com$|\.it$/ig

    Comment

    Working...