I am totally new to javascript.
I have a site mysite.com
, with tonnes of External links and I am trying to track every external link and append it as parameter to an external domain like
myanothersite.com/redirect.html?url=http://externallink.com`
using javascript.
myanothersite.com/redirect.html is a page which it redirects to passed url parameter after 5 seconds and i have created this page successfully.
In a nutshell, when a visitor clicks on external link, I don't want him to visit the external site directly. Instead I want to do this,
mysite.com
--> Visitor clicks on http://externallink.com
--> myanothersite.com/redirect.html?url=http://externallink.com
--> http://externallink.com
so, here I am trying write a js code that automatically detects external link and append it as a query parameter to
myanothersite.com/redirect.html?url=