How to make links to open in a target frame

September 14, 2006 by angelchen1111
Filed under: tips 

To make links in a web page to open in a target frame or new window all you need is to add target=”_blank” in between the <a href=”***”> section of the html code, where *** is the default target frame.

target=”_blank” Opens a page in new window
target=”_self” Opens a page in the same frame
target=”_top” Opens a page in the top page breaking all frames
target=”_parent” Opens a page in parent frame

We can also use target=”frame or iframe’s name” to make the link to open in that frame or iframe.

To make links to open in a target frame or new window by default add <base target=”***”> in between the <head> section of the code. This also works for Blogger’s templates, for Blogger Beta’s templates since it had to be XML compliant you have to add the closing tag </base> at the end to <base target=”***”> to make it work.

Comments

11 Comments on How to make links to open in a target frame

  1. onemargaret on Sat, 16th Sep 2006 1:08 am

    I like your site. It has a lot of valuable information. I am relatively new to this blog thing. Please visit my site and give me so suggestions. I could use them. I really would appreciate it. Have a nice weekend.

  2. Deathwinger on Thu, 19th Jul 2007 6:42 pm

    Hey, is there a way to make a hyperlink open two different pages in two seperate iframes?

    Like say I one frame was to show a title like GRAPHIC ART (title.htm) and the other was the body of that (body.htm), is it possible if I had a third frame that was a navigation menu and when I clicked on GRAPHIC ART link in that frame it would open the requested pages on the other two frames?

  3. rhymes on Fri, 5th Oct 2007 12:16 am

    I have some problems with the target links. I have a html page with 3 frames (left, top, and main), my navigation is on the topframe which I created in flash. When I click the button instead of going to the targeted link, it goes to another link. What happened? Can anyone help me plz?

  4. QA on Fri, 11th Jan 2008 4:26 pm

    I made a page with frames. Generally I try to avoid doing so, but it was the only thing that made sense in this case. To the point:

    The main frame contains two sub-frames: a menu frame, and a content frame. After creating these I realized they would not be centered if viewed on a large monitor, so I threw the whole frameset into an iframe and centered the iframe. Looks great on Safari, but FireFox seems to now disregard targets and open links in new tabs instead of the specified frame. What gives?

  5. Jaini Naveen on Tue, 21st Apr 2009 1:50 am

    Hi, I tried in your way but my page is getting load not in the frame it is openning in the same window not in the frame this is my code

    Gmail

    so please help me

  6. Jaini Naveen on Tue, 21st Apr 2009 1:52 am

    ohh sorry I pasted code but that is html code na the browser rendered that gmail link is made by my code even that is good ref for u click on that you will get to know the behaviour of the code

  7. puredragon on Mon, 6th Jul 2009 12:15 am

    firefox will open it up in a new tab instead of in the frame reson for this is because there is a option in firefox where u can tell it to open all new links into tabs.

  8. LongVehicle on Wed, 19th Aug 2009 12:06 am

    I want all links to open in iframe. This words for comments, but clicking on new post expand on whole window instead of inside of iframe. I tried putting everywhere target=’_self’, including base target. Firefox options offers me only to open all new links into tabs or windows, no frames are offered.

    Any help will be highly appreciated.

  9. Helpless on Sun, 28th Feb 2010 11:24 am

    Ttytytytytytytytytytytytyty…need this VERY MUCH.

  10. David on Mon, 16th Apr 2012 10:08 am

    Thanks! Just what we were looking for!

  11. Yar on Tue, 29th May 2012 3:45 pm

    I so thank you man

Tell me what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!