Azu Posted September 15, 2007 Share Posted September 15, 2007 Hi, can someone please tell me a way to make a link open in a new window in pure XHTML (not javascript/flash/activex)? I'd really really really appreciate it ^^ I've been trying to figure this out on my own for a while and I give up.. Oh and it would be even better if it would open in a new tab instead of a new window since new windows can be confusing.. Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted September 15, 2007 Share Posted September 15, 2007 <a href="http://www.anothersite.com" title="What ever" onclick="window.open(this.href); return false;" onkeypress="window.open(this.href); return false;">link text</a> ideally you should actually keep these eventtrigger attributes out of the html all together and use javascript to add the triggers... Quote Link to comment Share on other sites More sharing options...
Azu Posted September 15, 2007 Author Share Posted September 15, 2007 Sweet thanks! I was wandering how to do it in XHTML though not javascript. =S Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted September 16, 2007 Share Posted September 16, 2007 well if you use strict ahtml then you should stick to the standards. The standards state that a new wondow is a document effect and as such should be controlled with javascript. Browsers still open windows ifyou use target="_blank" BUT that is not valid markup in strict xhtml or xhtml 1.1 Quote Link to comment Share on other sites More sharing options...
Azu Posted September 16, 2007 Author Share Posted September 16, 2007 Aw.. I was hoping that there was a way to make a link open in a new window in XHTML since I want to keep my site pure XHTML instead of putting other programming languages in it.. Oh well thanks anyways ^^ Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted September 17, 2007 Share Posted September 17, 2007 pure xhtml is most certainly the way to go - strict and 1.1 are standards compliant technologies - as such they DO NOT have valid markup for style OR document effects. Those are for css and javascript. The beauty of it all is that what you shuld do is sit down and make a site that works with nothing - no javascript no css nothing. You then have a site that just works (in ANY client potentially). Then you style the site - make it look good and provde styles for different media (mobile phones, printers etc etc). THEN you add all the things to increase the users experience - flash, javascript. OPening a new window might seem like something you shoudl be able to do regardless - but many find it annoying, visually impaired are not likely to know they are in a new window and may not then know how to get back to the content they wanted.... Stick with the standards and you will make better sites... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.