prevent browser from opening a new tab

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Hi! I'm looking for a cross-browser hack (lol). It probably isn't
possible (security reasons), but I want to make it sure.

1. There is a flash application. It has hotlinking, so when You open it's redirected to

2. I want to have a possibility to insert a link somewhere, that
doesn't open a new tab, but changes url of the tab with the
application, so whole heavy flash doesn't have to reload, but simply
the javascript responsible for hotlinking fires an event that url

3. It's easy if I know tab name and can specify target of <a> element,

4. If I want to insert the hyperlink on forum or messenger, then I
can't specify target attribute. Pressing the link will open a new tab
and duplicate existing application.

So far I know how to make a link, that opens a new tab with
information, that data was opened by the application (next response
from server to the application will have information about new url).
But I want this new tab to never open! As far as I know, a tab allways
opens, even if URL is invalid - but sometimes it automatically close -
the only example I know is when server response gives a downloadable
mime-type (e.g. multipart/x-zip). So it is possible to link to some 0B
file instead of a page. Now a tab doesn't open, but it's even worse -
we have a modal window popuping, and it's an unelegant "hack".

Is it possible not to open this window (banned filetype or so?)
keeping tab closing behaviour? Probably not, because a user should
know that something was requested, but couldn't be loaded.

Thanks in advance
Marek Smolinski

Re: prevent browser from opening a new tab

Broadsmile wrote:
Quoted text here. Click to load it

It's impossible to control anything on the client from server-side code.

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Re: prevent browser from opening a new tab

Quoted text here. Click to load it

I was wondering if there is such response type, that is between a
download and a viewable content (no tab, no save/open question).
Thanks for Your answer, it seems that there's no solution. Well, I
have some idea - asking a user to download a small app, that does
nothing - only associates itself with some extension (e.g.
".donothing"), and configures browsers to automatically
open .donothing files. Now, server's response can be a .donothing file
- it's downloaded, but no propt pops up... Maybe the application can
be replaced with a batch file that already is on users computer - then
he would need only a .reg file to add new file extension... But still,
maybe someone heard about better idea, some silent error, i don't
know ;)

Re: prevent browser from opening a new tab


Quoted text here. Click to load it

What happens on the client-side is completly up to the browser. The
server doesn't know anything about windows, tabs and the like. HTTP just
delivers the content and describes what it is (the Content-Type), but it
doesn't tell the client anything about what to do with it.

Quoted text here. Click to load it

This would really smell like phishing or a trojan horse.

And BTW: You would have to associate it with a content-type, not an
extension. URLs don't have extensions.

Quoted text here. Click to load it

This sounds really broken. In fact your entire application seems to have
a real problem if opening some link in another tab causes you headache.
As said, how (and if at all) a browser opens a website is completely out
of your control.

Maybe you should change the layout of your app, so that it works better
in an environment like the WWW. Or make it a native app, which runs
directly on the clients without a browser.


Re: prevent browser from opening a new tab

On Sun, 31 Jan 2010 18:33:13 +0100, Michael Fesser wrote:
Quoted text here. Click to load it

Some people are, actually, really looking for X Window System instead.
They just don't know it yet.

Don't even get me started on the MCSEs I know.  It's a miracle of
modern technology that some of these fsckwits still draw breath,
much less a paycheck.
              -- Marc Bowden

Re: prevent browser from opening a new tab

Quoted text here. Click to load it

Because there's no solution, let's consider this discussion closed.
But in care of Your good dreams I'll explain why I want to do such
weird things: it's a browser-based* mmorpg. The page will be divided
to two modules (unresizable windows in constant position) - first
module will be a chat and second will change - like a tabbrowser's
content in a browser.
One module width is 500 px and it's constant. All content is designed
for 500px width then. Opening it in a new page will either center 500
px column or stretch it and it won't look good. There are other
reasons, e.g. "back" and "forward" buttons in the right module that
won't change module's content to these loaded in separate tabs (well,
it can, but that's rather an unexpected behavior!)

* - yes, browser based. Mentioned application would be an addon, just
a small option for these, who want the game to be more comfortable.

I always knew that server-side scripts can't directly control a
client. But because I couldn't do anything on client side before
sending request - opening a tab (inserting a link on foreign site -
can specify only a URL) I decided to ask on some popular server side
scripting discussion group: maybe - I thought - there is a common way
(not known by me, a noob) of accomplishing what I want to do - e.g.
some error type, like "the request comes from AJAX so for security
reasons you shouldn't open it in a new tab You silly browser!" ; D

You say: it's impossible; I say: that's all I wanted to know,
thanks : )

Site Timeline