My new XHTML page skeleton
Thinking of performance first, I try to include as few files as I can get away with. So no as few images as possible and no background images. The minimal XHTML you need has to include one extra file: a CSS stylesheet. Since in many cases, you also want to open links in a new window, you have the choice between XHTML Strict with an additional JavaScript to put the target="_blank" back in or XHTML Transitional.
The XHTML 1.0 Transitional skeleton
This skeleton allows the use of target="_blank" and iframes.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head><meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<!-- metadata -->
<title>Title (required)</title>
<!-- tech includes -->
<link rel="stylesheet" type="text/css" href="default.css" />
</head><body><div id="canvas">
<!-- content -->
</div></body></html>
The XHTML 1.0 Strict skeleton
If you want to open links in a new window, this skeleton needs a little JavaScript. For performance reasons, I've put it at the bottom of the page. I also made it inline to avoid an extra HTTP request.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head><meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<!-- metadata -->
<title>Title (required)</title>
<!-- tech includes -->
<link rel="stylesheet" type="text/css" href="default.css" />
</head><body><div id="canvas">
<!-- content -->
</div>
<!-- scripts -->
<script type="text/javascript">//<![CDATA
window.onload=function(){var o=document.getElementsByTagName('a'),i;for(i=0;i<o.length;i++)if(o[i].className=='external')o[i].target='_blank'}
//]]></script>
</body></html>
Comments
06/09/2007 19:41:12, Jan Schulz
Isn't 'target="_blank"' unessesary nowadays? Almost every browser has now support for tabbed browsing, so i think every user knows how to open a link in a new tab? I even have some user.js to strip them out, so that I have control how to open them.
06/09/2007 20:43:34, Michel Van der Meiren
You might have a point there. But sometimes you don't want to give the choice to the user :-)
06/09/2007 22:21:15, Jan Schulz
Bad guy! :-) But as long as my user.js works after your adding, I don't mind anymore :-)
BTW: can you enable comment feeds or add a 'notify me' function? I's kind of annoying to always get back to your blog (I read it via rss and just open the new article) and surf all the already read blogposts again, just to see if there are any interesting comments (which are a lot :-)
06/09/2007 23:03:10, Michel Van der Meiren
Yes, I was also thinking that a Comments RSS feed would be great. It's at the bottom of the right column.
12/06/2009 15:09:24, Bryan Copeland
Great resource... I still always find myself jumping back here for reference, 2 yrs. later!!!
Here's another two useful links that anyone who happens by mind be interested in:
1. Valid, mobile and backwards-compatible JavaScript in xHTML: http://javascript.about.com/library/blxhtml.htm
2. W3c tool for using Site Summaries in XHTML: http://www.w3.org/2000/08/w3c-synd/
12/06/2009 15:11:52, Bryan Copeland
Great resource... I still always find myself jumping back here for reference, 2 yrs. later!!!
Here's another two useful links that anyone who happens by mind be interested in:
1. <a href="http://javascript.about.com/library/blxhtml.htm">Valid, mobile and backwards-compatible JavaScript in xHTML</a>
2. <a href="http://www.w3.org/2000/08/w3c-synd/">W3c tool for using Site Summaries in XHTML</a>
12/06/2009 15:13:01, Bryan Copeland
Great resource... I still always find myself jumping back here for reference, 2 yrs. later!!!
Here's another two useful links that anyone who happens by mind be interested in:
1. Valid, mobile and backwards-compatible JavaScript in xHTML: http://javascript.about.com/library/blxhtml.htm
2. W3c tool for using Site Summaries in XHTML: http://www.w3.org/2000/08/w3c-synd/
To add a comment, log in or register as new user. It's free and safe.