Donate SIGN UP

HTML code writing - basic question

Avatar Image
dannyjoseph | 00:53 Thu 22nd Sep 2005 | Technology
14 Answers

I have a link to another site on my website. How do I get the link to open the other site in a different window to the current window?


Thanks

Gravatar

Answers

1 to 14 of 14rss feed

Best Answer

No best answer has yet been selected by dannyjoseph. Once a best answer has been selected, it will be shown here.

For more on marking an answer as the "Best Answer", please visit our FAQ.

If you are using the form <a target='_blank' href="link.htm"> </a>

then use <a target='_blank' href="link.htm" target="_blank"> </a>

That didn't come out as I wrote it.

Basically place  target="_blank"  immediately after the link and before the >

Trying the code in full again just to satisfy my curiosity.

<a href ="link.htm" target="_blank">

note though: you shouldn't really be doing this. there's nothing more annoying that pages opening in new windows.

if your visitor wants it in a new window, they can open it in a new window if they want. you shouldn't force it.

I find it far more annoying having to go "back" to the source page of a link rather than closing a new window.

Horses for courses.

Question Author

cheers for the help.

Re opening in another window, I stream music immediately from the new window so by having another window open a visitor can listen to my music while looking through my site on the original pages.

Question Author
oh, and by the way, the target="blank" worked. Thanks for that!
Music in a website? I hate that.

What if I'm listening to my own music?
precisely OBonio. Rule of interface designing: don't force things on your users.

same goes for my popup annoyances.

If you followed the "mustn't force things on your users" policy then I suppose you would ban Flash presentations to give you animations, and Acrobat pdf files to preserve document formatting.

How about you have a site and want to include a feedback form. The form is laid out with fixed input box sizes, and the boxes are ordered in a logical (we hope) way, followed by the ususal Submit, Clear and Exit butons. What is wrong in wrapping that in a fixed size new window (carefully designed to be smaller than the user's screen) that closes when submit or Exit is evoked?

Maybe you have some thumbnail pix that, when clicked, open new fixed size windows of larger versions. The user can close the larger pix and return to the thumbnails without reloading. Seems neat ot me!

How about you want to let folk explore another site but not loose track of yours, so when they close the "away" site they are returnd to yours for further broowsing? What's wrong there? (Broowsing is what contented cows do, mixture of munching and mooing!)

It's good web practice to open off-site windows in a new window. Also, if there is a link to streaming music, it's not going to be forced upon the user: They're going to have to click on it.

tomd: it is definitely _not_ good web practice to have external sites open in new windows. it's just frustrating for those who don't want it.

hippy: I would not ban flash no. Its current implementation is flawed, but that's due to accessibility issues. acrobat is great, but its not intended to replace websites. the only bad thing about it in fact is that its a proprietary file format.

for a feedback form, why not just have a normal page and call it the "feedback" page, with the form on it. no exit, as to get rid of it you just have to go to another part of the site (the site's main links are all there on the page too). once you've submitted feedback, it'll tell you that it's been seen successfully, and will allow you to get back to the home page or your last accessed page.

thumbnails: this is a reasonable use of new windows. new windows are not in themselves bad, that wasn't my point. my point was that new windows just for new sites is bad. but then again, if the visitor was using a good-enough browser such as opera or firefox (and not the atrocious IE6), then they could easily click their middle button to have the link (i.e. the fullsize picture in this case) open in a new tab, that can just as easily be closed as a popup window. but the idea is just the same. at least i'm not forcing the visitor to have a new window, or new tab.

If a visitor wants to explore another site, they can do. that's the whole point of hypertext. but you shouldn't make them return to your site once they've finished browsing that one, that's just bad practice. If they want to return, they will do. If they'd wanted to return, they'd have opened the external site in a new tab or window themselves, so they haven't lost where they are on your site.

You don't go by the name of William Gates do you?
Question Author

Thanks for the help re the actual code.

To add to this argument re music or no music, new window or not:

Given that I'm using my site as a promotional site (I DJ) and my link to the new window says click here to listen to 'xxxxx', then if somebody didn't want to listen to music they wouldn't click the link.

The new window lists a playlist and musical write up of what's playing. From a promotional point of view, I don't want people to stop listening to the music because they've clicked the 'back' button- I'd want them listening to the music as well as being free to explore my site further (which has details of up and coming dates etc)

I've been getting feedback from people suggesting that my site looks and works well thus far. I must be doing something right, me thinks!

And I second Kempie's 'horses for courses' comment.

dannyjoseph: yes, that is a good use of new windows.

1 to 14 of 14rss feed

Do you know the answer?

HTML code writing - basic question

Answer Question >>

Related Questions

Sorry, we can't find any related questions. Try using the search bar at the top of the page to search for some keywords, or choose a topic and submit your own question.