Amazon link redirects

in Script development
Subscribe to Amazon link redirects 1 post, 1 voice

Raam User
ChromeWindows

Hi All,

my friend has an amazon associate account and when ever I buy anything on amazon I buy it through his link but the problem is that when there amazon link in a website that I like or amazon send deals on email when I click the link it is not opened through his account but direct.

How do I redirect the link automatically to my friends link

say for example:
http://www.amazon.com/gp/search/ref=pe_173920_2...

I want it redirected automatically to
http://www.amazon.com/?_encoding=UTF8&tag=vijay...

Currently I am using:

var loc = location.href;
if (loc.match(/www.amazon.com\/$/))
{
window.location = 'http://www.amazon.com/?_encoding=UTF8&tag=vijay...';
}

which redirects automatically whenever I type amazon.com in the address bar.

Is this possible? How do I go about doing this?

Awaiting your response!
Thanks!