Computers, Programming, Technology, Music, Literature

Javascript: Change all hyperlinks in a page

leave a comment »

So, I had to download some youtube videos from the youtube search page, and for the past couple of years I have been fond of (kissyoutube, and site alike). I am not a big fan of youtube downloaders, and add ons; moreover these websites are online and all you need is change the video to Next you need to accept and run a java plugin and download these videos instantly.

Below javascript allows you to do exactly the same. Get all hyperlinks in the page, replace with 

var anchors = document.getElementsByTagName("a");

for (var i = 0; i < anchors.length; i++) {
    anchors[i].href = anchors[i].href.toString().replace("", "")


If you have JQuery enabled on a website, then you may use

$(this).attr('href', this.href.toString().replace('', ''));



Written by gmaran23

December 5, 2013 at 1:36 am

Posted in javascript

Tagged with , , ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: