views:

285

answers:

4

How can I do this?

In firefox the link opens in a new tab... I don't want users to have to set settings of their browsers for this...

I want a pop-up to appear with contact-form whenever user clicks 'contact' on my main page.

How should I do this?

Thanks...

+12  A: 

You cannot control this - it's entirely at the discretion of the user-agent; which is the point, after all. All you can specify is that the page be opened in a different viewpane context, and it's up to the user to decide how they want your window to take up their screen space/taskbar list/Alt-Tab shortcuts etc.

In fact I'd go even further and say that if at all possible you should avoid opening up a new tab/window at all. I know that I get a little annoyed when websites do this, and it feels a bit clunky and 1990s what with all the Ajax and floating divs and magic we have nowadays.

Andrzej Doyle
+2  A: 

I believe this is a browser-only setting that cannot be set from HTML or Javascript.

Joe
and shouldn't be.
Broam
+2  A: 
<a href="javascript:window.open('http://example.com/popup.html','blank')"&gt;Contact&lt;/a&gt;
Mark Byers
I believe you mean window.open.
Sean McMillan
And `_blank`. And `void`, else the window reference's `toString` will replace the current document. And it still doesn't work (will open in new window if that's how the browser is configured). And inaccessible due to the needless use of `javascript:` URLs (don't ever use those).
bobince
I certainly don't think you should do this, but you can. The inaccessible javascript URLs is a problem that can be easily solved by modifying the document onLoad.
Mark Byers
A: 

You cannot specify a link opens in a new tab - remember that not all browsers support tabs!

Steve Kemp
But that's not what he asked.
Mike C.