It worked, Thanks
![]() |
|
| www ITBlog Articles Topics Forums Main |
You maybe know that you can't validate as xhtml strict a page if you use
the target attribute for the a element in xhtml strict can't be recognized as possible value: in fact the XHTML strict DTD do not include this attribute.Code:<a href="http://www.w3it.org" target="_blank">w3it.org</a>
There is a way in any case to fix the problem and achieve the result, creating a link that will be opened on another browser Page or Tab ( like the target="_blank" do ). The following code reproduce the same effect as the above link where is used the attribute target, but it is XHTML STRICT compatible:
w3it.org in effect, use this tip for any external linked page.Code:<a href="http://www.w3it.org" onclick="window.open(this.href,'_blank');return false;">w3it.org</a>
It worked, Thanks
Hehe for lamer like me that want to do xhtml strict pages this kind of things are very very important!
It's working but it's not the best solution because if you haven't enabled your JavaScript, this won't work.
Solution by axew3 is correct:
if javascript is not enabled in the browser, than the link will be opened in the same window or tab.if you haven't enabled your JavaScript, this won't work.
So the javascript solution let work correctly the link anyway, not as target _blank if js isn't enabled, but (clearly) like target _self.
And now so, what's your best solution? I know there aren't more!
I have been building a website devoid of any java-script and want to keep it that way. What other meathods can I use to use the: target="_blank" in css or xhtml strict 1.1?
i think this is the definitive answer:
If a user wanted to have new windows open in new tabs instead, she could use the following user style sheet to do so:but it is CSS 3, and while we are waiting for compliance of all browsers with the w3 consortium standards CSS3, for what is my experience there is nothing best than the above javascript code (that can be implemented in various ways, also using for example the jquery library).Code:* { target-new: tab ! important }
CSS3 Hyperlink Presentation Module.
The CSS 3 will solve all problems about strict DTD validations for web documents. Don't know, and i will check soon, what browsers are compliant with css3, if there are someone; would like to know what about many others standards and directives at the w3c, what's the state of development, what releases, when in case etc...
Code:# target-name: current | root | parent | new | modal | <string> # target-new: window | tab | none # target-position: above | behind | front | back # target: <target-name> || <target-new> || <target-position>P.S - more about the problem solving for target _blank and strict validation, there isn't any Apache directive that can be configured to give target blank for all or specifics links, ever for what i know, and i never have think to this in Php, where also i don't think it can be possible without javascript. The fact is that the link is processed by the browser (client side) when you click with your mouse and there is nothing you can do for this in the server side. When browsers will have css3 standards implemented, than we will have many more powerful features in our hand.above
The new destination tab (window) is placed above the current tab (window) respectively.
behind
The new destination tab (window) is placed behind the current tab (window) respectively.
front
The new destination tab (window) is placed above all other tabs (windows) respectively.
back
The new destination tab (window) is placed behind all other tabs (windows) respectively.
The Css3 home page at the world wide web Consortium (w3c).
last added to this post on: 25 Jul 2012
More precisely, for css3 hyperlinks we should look at:
CSS3 hyperlinks page
IT REALLY WORKS!*
*just for you pAvax
You were the first solution on a google search. Kudos your way ...
Bookmarks