How To Redirect Each Link On The Webpage Through Another Link Using Javascript Or Any Html?
How to Redirect each link on the webpage through another link using JavaScript or any html? I have a website - www.example.com I have few links on each page like - www.link1.com
Solution 1:
var remember = [].slice;
var to = 'a';
var post = document.getElementsByTagName(to);
var relevant = remember.call(post);
var code = 'https://example.com?redirect=';
relevant.forEach(function(atag) {
var href = atag.href;
if ( href ) {
atag.href = code + encodeURIComponent(href);
}
});
Post a Comment for "How To Redirect Each Link On The Webpage Through Another Link Using Javascript Or Any Html?"