# How to prevent link to open in new window



## subhash (Jun 4, 2005)

I am just learning to develop web pages and what I am trying to do is create a Home Page with a top frame and a bottom frame split into two columns. The top frame is supposed to contain a logo, site description and a slogan. The bottom left frame is supposed to contain my navigation bar and another image and bottom right frame is supposed to load all my links in.

I first tried using frameset with target attribute (using Dreamweaver 8) and it gave me a problem i.e. one of the links from my navigation bar will always open in a new window. Not only that, once opened in the new window, it wouldn't even go back by using the browser's back button. I have to click the back button a few times in quick succession to be able to go back to my home page.

I then started developing the same page using tables. Even with tables, it does the same thing.

I have always found my answers here at TSG forums and very confident that the good guys here will help me out again.

Please advise what I can do to fix this behaviour or better yet if there is free template out there which will let me do what I want to do, I would love to lay my hands on that.

I thought I will post my HTML as will in case that helps.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Untitled Document




*This is my test Website*

*Currently Under Costruction *

 
[TD]



Cricinfo
MLS






Thanks in advance for your help.....

Subhash.


----------



## tomdkat (May 6, 2006)

Try specifying a target of "_self" instead of "view" and see what happens.

You can read about that here.

Peace...


----------



## subhash (Jun 4, 2005)

tomdkat said:


> Try specifying a target of "_self" instead of "view" and see what happens.
> 
> You can read about that here.
> 
> Peace...


I tried specifying target="_self" and it still opens in a new window. I forgot to mention in my original post that the first link (the link to cricinfo) in my code works fine but the link to MLS always opens in a new window. I believe it something specific to that site.

Thanks for your help.....

Subhash.


----------



## Shadow2531 (Apr 30, 2001)

The site uses a framebuster script.

See http://www.mls.ca/presentation/javascript/common.js


----------



## Rockn (Jul 29, 2001)

I believe that MLS web site is using coding that prevents browsers from opening their site in frames.


----------



## subhash (Jun 4, 2005)

Rockn said:


> I believe that MLS web site is using coding that prevents browsers from opening their site in frames.


I think so too. But is there a way I can override that by including some kind of script in my page ?

Thanks.

Subhash.


----------



## subhash (Jun 4, 2005)

Shadow2531 said:


> The site uses a framebuster script.
> 
> See http://www.mls.ca/presentation/javascript/common.js


It seems that way. Btw, how did get a link this js file ? I would like to learn.

So, do you think I can do anything to override that ?

Thanks.

Subhash.


----------



## Shadow2531 (Apr 30, 2001)

subhash81 said:


> It seems that way. Btw, how did get a link to this js file ? I would like to learn.


Goto http://www.mls.ca/ and view source. Look at the script elements.



> So, do you think I can do anything to override that ?


You really shouldn't worry about it. Once someone notices that the site tries to break out of frames, they'll just middle-click on the link in your menu to open that site in a new tab to avoid the problem.

I can't think of a way to avoid it from your page at the moment.

Do you really need to use frames in the first place?


----------



## subhash (Jun 4, 2005)

Shadow2531 said:


> Goto http://www.mls.ca/ and view source. Look at the script elements.
> 
> You really shouldn't worry about it. Once someone notices that the site tries to break out of frames, they'll just middle-click on the link in your menu to open that site in a new tab to avoid the problem.
> 
> ...


Not really. I don't have to necessarily use frames if I can do it another way. I will really be grateful if you guide how to accomplish this without using frames. What I want is two static areas, one at the top for company logo and company slogan etc. and one on the left for the navigation bar. These two areas should always be visible and a third area where all the links will open up. I want the user to be able to click the HOME link from anywhere and return to my home page.

Thanks for your help....

Subhash.


----------

