Opening links in a new window. (Full Version)

All Forums >> [Web Development] >> Cascading Style Sheets



Message


austizzmo -> Opening links in a new window. (6/19/2003 20:59:28)

when attempting to validate my html pages with the W3C validator, i learned that the target attribute is not valid. my page makes extensive use of the target attribute and id like to know if there is a way to use css to rid myself of the target attribute. id need to open pages in a new window and in an iframe with the name " mainwin" . thanks in advance.




gorilla -> RE: Opening links in a new window. (6/20/2003 7:12:28)

CSS is used to deal with presentation not structure.

Med venlig hilsen

Karsten

Who is now the deputy spokesgorilla ' cos I believe in social mobility for all alpha gorillas and was delighted to discover that a dark night and a big stick are excellent ways of achieving this ..... muhaha .....

København
20 juni 2003




Thomas Brunt -> RE: Opening links in a new window. (6/24/2003 10:30:12)

I believe Gorilla is trying to say that this is an html question as opposed to a css question. I have no idea why someone would say that and then not go on to offer any assistance toward answering your problem.

I was unaware that the _target attribute was invalid. Did you checkmark the " verbose" output?

t




pageoneresults -> RE: Opening links in a new window. (6/24/2003 13:45:23)

It will depend on which DTD (Document Type Definition) that you are validating against. HTML 4.01 Transitional allows the use of target. I believe it is invalid in HTML 4.01 Strict and XHMTL.

Web designers can use the TARGET=NEW attribute on an anchor in Hypertext Markup Language (HTML) to enable users to open a second window in Internet Explorer, but NEW is not a supported attribute for the target tag. If you click a hyperlink that uses the TARGET=NEW attribute, a second Internet Explorer window may open, but if you click subsequent hyperlinks by using the same attribute, a third Internet Explorer window does not open.

This behavior occurs because there may be an error in the HTML coding, which is used to set up the Web site. There are five possible ways that the target attribute can be used. The following list details how to use the correct target attribute, according to the World Wide Web Consortium (W3C):

TARGET=_BLANK
Loads the hyperlink into a new, blank, nameless window

TARGET=_PARENT
Loads the hyperlink in the parent of the document that contains the hyperlink

TARGET=_SELF
Loads the hyperlink in the same window in which you click the hyperlink

TARGET=_TOP
Loads the hyperlink in the full body of the window

TARGET={variable}
Loads the hyperlink in the {variable} window

Hyperlinks that use the TARGET=_BLANK attribute always open a new Internet Explorer window, while hyperlinks that use the TARGET=NEW attribute open a new Internet Explorer window only once.




abbeyvet -> RE: Opening links in a new window. (6/25/2003 11:23:00)

quote:

Hyperlinks that use the TARGET=_BLANK attribute always open a new Internet Explorer window, while hyperlinks that use the TARGET=NEW attribute open a new Internet Explorer window only once.


To expand a little on this.

That is because all you have done there is given the new window the name ' new' . You could have equally called it ' mickeymouse' or ' london' or ' john' or anything you like.

Once you have named a window, or in fact a browser instance, any link that specifies the same name will open in the named window, if it still exists. If it has been closed it will create it again.

This seems really handy, and can be in certain situations, but you need to be careful as there is the potential for confusion.

Take this scenario.

A user opens the first link whose target is ' new' . A new browser window opens and show the page. Fine. The user now tabs back to the links page. The clicks a second link, also specifying the window ' new' . The link opens in the still existing window ' new' .

BUT - and this is the important bit - the window ' new' does not come to the front when the new link opens in it. The user has to know to tab to that window and see the second page now in it. Many won' t realise that and may believe that your link is broken.

If you are linking to pages that are your own, you can add this in your body tag:

onload=" focus()"

which will cause the window to come to the front when a new page is loaded. However more often than not it is external links that are linked to in new windows (a practice that has its pros and cons also, but nevermind that now), and you have no way of adding something like that to them.

So really, if you just want an new window, reliably and in a way not fraugt with usability issues then _blank is your best bet. Save the named windows for very particular situations.




austizzmo -> RE: Opening links in a new window. (7/1/2003 17:02:45)

thanks alot for your help. i wasnt aware that this would have been better asked in the HTML forum as i was trying to find a way to use CSS to open the links. but since i can' t ill just valitdate may pages with transitional rather than strict. once again, thanks.




gorilla -> RE: Opening links in a new window. (7/4/2003 6:02:29)

I should have checked this topic earlier. Life has been a little hectic recently and is about to get more so [:' (]

Checking back my notes for that day I recall that I was up to my tonsils and a bit fraught. None of which excuses my rudeness or not giving a full reply explaining the difference.

Sorry Austizzmo - and thanks to both abbeyvet and pageone results for doing what I should have done.

And Thomas - I hope you know me well enough by now to know that my thanks to you should go without saying.

Med venlig hilsen

Karsten

A stupendously alpha gorilla silverback gorilla male spokesgorilla and banana quality controller. The said status being courtesy of an appreciation of the laws of gravity, unwary rivals, vaseline on the vines, and the occasional judicious push inflicted upon wary, but not quite wary enough, rivals from behind on dark nights. I would like to thank outfront' s very own <blonde>borg-gorilla hybrid </blonde> preludeok95 for sharing her wisdom on these matters with me.

Yea verily it am the truth that behind every successful usurper there stands a devious outfronter .........

Happy coding

København
Danmark
Juli 04 2003




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.0625