Using an extension for Firefox or Google Chrome, how can I modify all links on a page such that

<a href="www.google.com">Google</a>


<a href="http://www.google.com">http://www.google.com</a>



Tampermonkey is Greasemonkey alternative for Google Chrome.

  • It needs to be an extension? – soandos May 21 '12 at 20:34
  • Does not matter. You can suggest different approach. – Kerberos May 21 '12 at 20:39
  • Why do you close the opening tag right away <a … /> </a>? Where did you get that HTML syntax from? – slhck May 21 '12 at 22:09
  • @slhck I've cleaned up the question. :) – iglvzx May 22 '12 at 2:27
  • @slhck thank you very much for cleaned up the question. – Kerberos May 22 '12 at 7:59

I wrote you a simple Greasemonkey userscript to replace
<a href="URL">TEXT</a> with <a href="ABSOLUTE_URL">ABSOLUTE_URL</a>:

// ==UserScript==
// @name        Replace Link Text with URL
// @namespace   http://igalvez.net
// @description Replaces <a href="URL">TEXT</a> with <a href="ABSOLUTE_URL">ABSOLUTE_URL</a>
// @version     1.0
// @require     http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js
// ==/UserScript==

$("a").each(function() {
    var url = this.href;
    $(this).attr('href', url);

Note: This will break most page layouts, as URL's can be quite long.


  • 1
    Crazy. Awesome. Crazy awesome! – nhinkle May 22 '12 at 2:27
  • @nhinkle As Spiderman once said, "With 1337 skillz comes great responsibility." – iglvzx May 22 '12 at 2:29
  • 1
    As Abraham Lincoln once said, "The Internet is an amazing thing." – nhinkle May 22 '12 at 3:30
  • This might be better as a bookmarklet - click to reveal URLs. That should keep page layouts intact until needed. – Bob May 22 '12 at 6:51
  • You can quickly enable/disable the script with a click, if the Greasemonkey icon/menu is on a toolbar. – iglvzx May 22 '12 at 7:07

And here's a bookmarklet version based off iglvzx's answer. The advantage of a bookmarklet is the page will look normal until the button (link) is pressed. As iglvzx noted, URLs tend to be long and break page layouts.Of course his Greasemonkey version is possible to enable permanently on a per page basis. The main difference is Greasemonkey is designed to be on most of the time, while a bookmarklet is off most of the time. It's browser agnostic, as long as jQuery and JavaScript bookmarklets work.


Made using this tool.

You can add as a bookmarklet directly with the link available at the following link:


Just copy and paste into the address bar. Adding as an actual link seems to break something. As both Markdown and HTML, too!

  • Nice. Good idea. :) – iglvzx May 22 '12 at 7:11

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.