Opening a Link in a New Back Window
Anyone know off the top of their head how to get a regular HTML link to bring up the linked document in a new background window when clicked? I do not control the document being linked to. The goal is to run through a site such as Artima or Digg and click all the interesting links. Then close the window and have all the articles opened there for me to read. In my case, I can control the page I’m linking from but not the page I’m linking to. This is for my personal aggrgeator so it only needs to work in Firefox. Ideas?
January 18th, 2007 at 10:30 AM
In that situation, I just middle-click (what, no third button/mousewheel? Buy new mouse at once!), and unmodified Firefox nicely opens the linked-to page in a tab but without switching to it. I get in the habit of doing that to the point where I’m annoyed when other apps that display hyperlinks don’t respond “correctly” to the middle click.
Then when I’ve worked through the linking page completely, I just close its tab and move rightward, continuing to read, middle-click, and close until I run out of tabs. I have also configured FF to open links that ask for a new window in a new tab instead (Tools/Options/Tabs). Then back to my RSS reader (Google Reader, in the leftmost tab) and start over. Warning: whole mornings can vanish this way. It’s a big Web.
January 18th, 2007 at 10:31 AM
Addendum: FF 2.0 makes this even easier than FF 1.x did, because the tabs are scrollable rather than just getting smaller and smaller.
January 18th, 2007 at 1:30 PM
John’s middle click is new to me, but wow, it works. I usually do the two-handed shuffle. Hold Control and click the link (normally, with the left mouse button) will open the link in a new tab underneath the current one. I have the same setting as John, to open new links as tabs, I’m not sure if you don’t have this setting if it will open as a tab or window
January 18th, 2007 at 2:08 PM
Opening in background tabs certainly works (and its what I do) but I don’t think it handles the question. I think the general algorithm is 1.) open the child window 2.) child window becomes the foreground 3.) Do something to make the parent window the foreground, thus opening the child window in the back.
Since these awful things were used so much in pop up and pop behind ads, I would think the Javascript for how to do this is well known. According to some sleazy looking websites, the code looks like this:
childWin = window.open(theChildUrl);
childWin.blur();
childWin.focus();
January 18th, 2007 at 2:27 PM
damn…sorry, i meant window.focus() instead of childWin.focus();
January 19th, 2007 at 2:54 PM
I think if you use target attribute of the link it should work.
For example
Link 1
This should open link in new window.
another link like Link 2 will open the link in previously opened window.
January 19th, 2007 at 3:00 PM
Looks like target attribute was removed from my links when I posted them.
Hopefully this works.
Link1 should be
<a target=”mybgwin” href=”link1″>Link 1</a>
Link2 should be
<a target=”mybgwin” href=”link2″>Link 2</a>
January 22nd, 2007 at 1:43 PM
Maybe not a useful answer since you prefer Firefox, but what I do for this is to use Shiira, with the “select new tabs as they are created” preference turned off. A particularly nice use for this is to select a range of text, ctrl-click, and get the menu item “open all links in background tabs (X)”, where X is the number of highlighted links.
January 22nd, 2007 at 7:02 PM
Welcome to the “background multi-open” club.
If on the Mac:
On Safari: Apple-Shift Click
On Firefox: Apple-Alt Click (or Apple Click if you didn’t select the switch to new tabs in the Preferences)
Or on Firefox Middle Click (I personnaly bind Middle Click to Expose to view the Desktop)
January 30th, 2007 at 8:03 PM
In Safari, I use Command-Shift-Option-click to open links in a new window behind the current window. If you view Safari’s status bar you can see what all the modifier keys will do when you mouseover a link.
March 17th, 2008 at 12:47 AM
How about the other side of the problem? I’ve built a site with eight windows, each of which has links to open any of the others in a new tab. If the others are not open, they open in a foreground tab when clicked (IE, Firefox, Opera on PC), which is what I want. When they are already open, I don’t want to open another copy, I just want to switch the focus to the tabbed window in which the object of the click is already open. I’ve tried:
function newview(url, name) {
var x = window.open(url, name);
x.focus();
};
where the javascript window.open command correctly does not open a new window if the page I want is already loaded into a (tabbed) window with the name I want. But only Opera heeds the x.focus() command; in IE or Firefox the focus doesn’t change. Anyone know of a way to work around this?
Thanks,
David