![]() |
How can I make links re-direct in a new window?
I have a few links on my site that link to other sites, but it does so in the same window. What HTML script do I have to write to make a new window open so the view will also stay at the original page at my site?
|
Code:
<a href="http://link" target="_blank">link</a> EDIT: Bleh, the [code] tag doesn't work properly :( |
you do
Code:
< a href=blah.html target=_new >link test< /a > |
|
you can also do :: target="_blank" :: for this.
|
Check this out. It is a little more complex, but it alllows for a lot more flexibility.
PHP Code:
|
Bah.. I really hate it when webmasters force me to browse their way with non-resizable windows. At least make resizable=yes, or try it out on as many browsers as you have access to since not all browsers render the same.
|
When you add the target attribute to your anchor tag you can give it a certain name. target="_blank" will always open a new blank window but you don't have to do this. If you want you can have all your links open in a window different than your page is on but they will all open in the same one.
Let me explain it better. Say you added target="link" to all your links. On your page you included a link to CNN, Toms Hardware, and the TFP. Now say I was on your site and I clicked on the CNN link. It would get a new window with CNN. Then I clicked on the lead story on CNN and I still have two windows. One with your page and another with the lead CNN story. Now say I switched back to your page and I clicked on the TFP link. TFP would open up not in an entirely new window but the one where the CNN story is. The is because the target attribute give the new window a name, in this example "link". So each link that points to the windows named "link" will open in that window even if the site currently display is not what was originally opened in that window. |
i'm sorry but i feel javascript for opening a window is only used for ads and annoying popups
target="_blank" is really al you need. javascript is ok but u dont really need all that stuff... unless you are making a popup ad |
I have to disagree. Although you can do it much easier with the target. You can get much more control over the window layout and such. If you are opening up a page for announcements or or help page then why waste all that valuable pixel space with chrome. I just depends what you want I guess.
|
Quote:
Give the users of your site the option of opening in a new window or not. Ok, you have to use javascript, but it works great! Have a look at http://www.dynamicdrive.com/dynamicindex8/newwindow.htm and http://www.dynamicdrive.com/dynamicindex8/newwindow2.htm edited cause I can't type! |
All times are GMT -8. The time now is 01:43 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project