coding to open linked sites in different window

They have: 140 posts

Joined: Nov 2003

Hi-

How do you make it so that when someone clicks on a link
to another site outside of yours, that the new site opens in
a different window?

So the result is that your site remains open and the linked site
is also open, and when they are done with the linked site they can
just close it and continue on at your site.

Any help is appreciated.

CBC58

The Webmistress's picture

She has: 5,586 posts

Joined: Feb 2001

All you need to do is add target="_blank" to your link

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

If you're using XHTML strict, you need to control it through scripting instead of the markup. Any language below XHTML 1.0 Strict you can use the target attribute as Julia said.

With XHTML 1.0 Strict, you have to extend the DTD to use the target attribute, or use scripting. See Accessify.com for the full details.

They have: 140 posts

Joined: Nov 2003

Thanks.

That works.... and now I have another question.... is there
a way to make it so that the window that opens doesn't entirely
cover up my existing page.?

In other words... can I tell the link to open the linked
page at say 75% of actual size?.. so that the user can see that
a separate new page has indeed opened.

Thanks

druagord's picture

He has: 335 posts

Joined: May 2003

with this technic the window will open at the default size wich you can't control to specify a size you will need to use a popup (window.open in javascript) but that can be blocked by popup killer

IF , ELSE , WHILE isn't that what life is all about

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

zerocattle.com/examples/popUp.html

If you use this code, the popup with not be blocked (or will, hopefully, not totally screw people over if they choose to open in a new tab instead).

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.