Follow Links Without Clicking Them

Follow Links Without Clicking Them

Hover over any link for a short time to open it in a new tab in the background.

This hack was inspired by (, a site that demonstrates some user interaction techniques that don't involve clicking. The site is written in Flash, which annoys me, but it gave me the idea of lazy clicking: the ability to open links just by moving the cursor over the link and leaving it there for a short time. I don't claim that it will cure your carpal tunnel syndrome, but it has changed the way I browse the Web.

The Code

This user script runs on nonsecure web pages. By default, it will not run on secure web pages, because it has been my experience that most secure sites, such as online banking sites, are very unweblike and don't support opening links in new tabs.

The script gets a list of all the links (which Firefox helpfully maintains for us in the document.links collection) and attaches three event handlers to each link:


When you move your cursor to a link, the script starts a timer that lasts for 1.5 seconds (1500 milliseconds). When the timer runs down, it calls GM_openInTab to open the link in a new tab.


If you move your cursor off a link within 1.5 seconds, the onmouseout event handler cancels the timer, so the link will not open.


If you actually click a link within 1.5 seconds, the onclick event handler cancels the timer and removes all three event handlers. (Note that you can click a link without leaving the page; for example, holding down the Ctrl key while clicking will open the link in a new tab.) This means that if you manually follow a link, the auto-open behavior disappears and the link will not open twice.

Save the following user script as autoclick.user.js:

	// ==UserScript==

	// @name AutoClick

	// @namespace

	// @description hover over links for 1.5 seconds to open in a new tab

	// @include http://*

	// ==/UserScript==

	var _clickTarget = null;

	var _autoClickTimeoutID = null;

	function mouseover(event) {

		_clickTarget = event.currentTarget;

		_autoclickTimeoutID = window.setTimeout(autoclick, 1500);


	function mouseout(event) {

		_clickTarget = null;

		if (_autoclickTimeoutID) {




	function clear(elmLink) {

		if (!elmLink) { return; }

		elmLink.removeEventListener('mouseover', mouseover, true);

		elmLink.removeEventListener('mouseout', mouseout, true);

		elmLink.removeEventListener('click', click, true);


	function click(event) {

		var elmLink = event.currentTarget;

		if (!elmLink) { return false; }




	function autoclick( ) {

		if (!_clickTarget) { return; }




	for (var i = document.links.length - 1; i >= 0; i--) {

		var elmLink = document.links[i];

		if (elmLink.href && elmLink.href.indexOf('javascript:') == -1) {

			elmLink.addEventListener('mouseover', mouseover, true);

			elmLink.addEventListener('mouseout', mouseout, true);

			elmLink.addEventListener('click', click, true);



Running the Hack

Before running this hack, you'll need to set up Firefox so that it doesn't bring new tabs to the front. Go to Tools Options Advanced. Under Tabbed Browsing, make sure "Select new tabs opened from links" is not checked, as shown in Figure.

Firefox tab options

Now, install the user script (Tools Install This User Script), and go to Hover over any link for a short time (1.5 seconds to be precise), and the link will open in a new tab in the background, as shown in Figure.

Auto-opened link

The script is smart enough not to reopen links you've already opened. If you move your cursor away from the link you just opened, then move it back to the link, it will not open a second time.

The script is also smart enough not to auto-open links you've already clicked. If you move to another link and click while holding down the Ctrl key (or the Command key on Mac OS X), Firefox will open the link in a new tab in the background. If you move away from the link and then move back, it will not auto-open no matter how long you hover over it.

     Python   SQL   Java   php   Perl 
     game development   web development   internet   *nix   graphics   hardware 
     telecommunications   C++ 
     Flash   Active Directory   Windows