<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Code Couch &#187; Web Development</title>
	<atom:link href="http://www.codecouch.com/tag/web-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.codecouch.com</link>
	<description>The ramblings of two code monkeys</description>
	<lastBuildDate>Thu, 19 Nov 2009 15:47:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How do I use the  tag?</title>
		<link>http://www.codecouch.com/2005/12/how-do-i-use-the-script-tag/</link>
		<comments>http://www.codecouch.com/2005/12/how-do-i-use-the-script-tag/#comments</comments>
		<pubDate>Fri, 23 Dec 2005 14:20:26 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.codecouch.com/?p=115</guid>
		<description><![CDATA[I use Javascript every day in my web projects - and have often been asked for details on how to use the <script> tag correctly. This post gives details on the correct use and links through the W3C with the formal specifications.]]></description>
			<content:encoded><![CDATA[<p>I use Javascript every day in my web projects &#8211; and have often been asked for details on how to use the <b>script</b> tag correctly. The W3C have a formal description of the <b>script</b> tag which includes a summary of the required (and optional) attributes.</p>
<p>In the past, browsers have used various techniques to handle the <b>script</b> contents… and this has had a long lasting effect on the way we use this tag in our current projects. The most abused attribute remains in common use today (even though has been deprecated in HTML 4.01 and XHTML 1.0 Strict) &#8211; the language attribute. Instead of specifying the language, it is now standard to specify the MIME type through use of the type attribute &#8211; and it is important to note that this is the only required attribute for the <b>script</b> tag.</p>
<div class="seeThrough h2Pod "><div class="seeThroughTop"><span class="tl"></span><span class="tr"></span><span class="t"></span></div><div class="seeThroughMiddle"><span class="r"></span><span class="l"></span><span class="m"></span><div class="seeThroughContent">
	<h2>Inline Javascript</h2>
</div></div><div class="seeThroughBottom"><span class="bl"></span><span class="br"></span><span class="b"></span></div></div>

<p>If you are including some Javascript in the document itself, then you would use a construct similar to this:</p>

<div class="wp_syntax_outer"><div class="wp_syntax"><div class="wp_syntax_inner"><pre class="javascript" style="color: #000000;"><span class="sy0">&lt;</span>script type<span class="sy0">=</span><span class="st0">&quot;text/javascript&quot;</span><span class="sy0">&gt;</span>
<span class="kw3">alert</span><span class="br0">&#40;</span><span class="st0">&quot;Hello world!&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="sy0">&lt;/</span>script<span class="sy0">&gt;</span></pre></div></div></div>

<p>If you are delivering this content in a document that is using an XHTML doctype, then you should comment the data between the <b>script</b> tags (if you are unable to include it as an external Javascript file &#8211; see below) so that it is not parsed client-side. In the past you would often see a similar technique in use to “hide the code from older browsers” (note that the following example shows the correct way to use comments in an XHTML document using CDATA):</p>

<div class="wp_syntax_outer"><div class="wp_syntax"><div class="wp_syntax_inner"><pre class="javascript" style="color: #000000;"><span class="sy0">&lt;</span>script type<span class="sy0">=</span><span class="st0">&quot;text/javascript&quot;</span><span class="sy0">&gt;</span>
<span class="co1">//&lt;![CDATA[</span>
<span class="kw3">alert</span><span class="br0">&#40;</span><span class="st0">&quot;Hello world!&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="co1">//]]&gt;</span>
<span class="sy0">&lt;/</span>script<span class="sy0">&gt;</span></pre></div></div></div>

<p>There is no point using the CDATA comments above in a non-XHTML page at all. Nor is there any value in using the following kind of comments (whether you are working on an HTML or an XHTML document). This commenting was widely used to prevent “old browsers” seeing the Javascript. Nobody uses these “old browsers” for regular web use (and if they did, most web sites that use Javascript would break anyway)… so there is absolutely no point in including the comments:</p>

<div class="wp_syntax_outer"><div class="wp_syntax"><div class="wp_syntax_inner"><pre class="javascript" style="color: #000000;"><span class="sy0">&lt;</span>script type<span class="sy0">=</span><span class="st0">&quot;text/javascript&quot;</span><span class="sy0">&gt;</span>
<span class="co1">//&lt;!--</span>
<span class="kw3">alert</span><span class="br0">&#40;</span><span class="st0">&quot;Hello world!&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="co1">//--&gt;</span>
<span class="sy0">&lt;/</span>script<span class="sy0">&gt;</span></pre></div></div></div>

<div class="seeThrough h2Pod "><div class="seeThroughTop"><span class="tl"></span><span class="tr"></span><span class="t"></span></div><div class="seeThroughMiddle"><span class="r"></span><span class="l"></span><span class="m"></span><div class="seeThroughContent">
	<h2>Linked Javascript</h2>
</div></div><div class="seeThroughBottom"><span class="bl"></span><span class="br"></span><span class="b"></span></div></div>

<p>If you are including an external Javascript file in the document, then you would use a construct similar to this:</p>

<div class="wp_syntax_outer"><div class="wp_syntax"><div class="wp_syntax_inner"><pre class="javascript" style="color: #000000;"><span class="sy0">&lt;</span>script type<span class="sy0">=</span><span class="st0">&quot;text/javascript&quot;</span> src<span class="sy0">=</span><span class="st0">&quot;helloworld.js&quot;</span><span class="sy0">&gt;&lt;/</span>script<span class="sy0">&gt;</span></pre></div></div></div>

<p>The only difference between inline and linked Javascript is that the latter uses the src attribute to specify where the linked Javascript file resides.</p>
<div class="seeThrough h2Pod "><div class="seeThroughTop"><span class="tl"></span><span class="tr"></span><span class="t"></span></div><div class="seeThroughMiddle"><span class="r"></span><span class="l"></span><span class="m"></span><div class="seeThroughContent">
	<h2>Setting a default scripting language</h2>
</div></div><div class="seeThroughBottom"><span class="bl"></span><span class="br"></span><span class="b"></span></div></div>

<p>When writing well formed documents, you should include information about the default scripting language. This can be done using a meta tag in the document:</p>

<div class="wp_syntax_outer"><div class="wp_syntax"><div class="wp_syntax_inner"><pre class="html4strict" style="color: #000000;"><span class="sc2"><span class="kw2">&lt;META</span> <span class="kw3">http-equiv</span><span class="sy0">=</span><span class="st0">&quot;Content-Script-Type&quot;</span> <span class="kw3">content</span><span class="sy0">=</span><span class="st0">&quot;text/javascript&quot;</span><span class="kw2">&gt;</span></span></pre></div></div></div>

<p>This is good practice, but is not required &#8211; especially if the server is already serving linked Javascript files as “text/javascript” (or more correctly: “text/x-javascript”).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codecouch.com/2005/12/how-do-i-use-the-script-tag/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How do I choose a Doctype?</title>
		<link>http://www.codecouch.com/2005/12/how-do-i-choose-a-doctype/</link>
		<comments>http://www.codecouch.com/2005/12/how-do-i-choose-a-doctype/#comments</comments>
		<pubDate>Tue, 20 Dec 2005 06:55:51 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[HTML/XHTML]]></category>
		<category><![CDATA[Doctype]]></category>
		<category><![CDATA[Standards]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.codecouch.com/?p=120</guid>
		<description><![CDATA[When should you choose a transitional doctype over a strict one? What is the correct usage of the frameset doctype? This post gives you all the details you need to choose the right doctype for your web site.]]></description>
			<content:encoded><![CDATA[<p>As the <a title="Click to visit the World Wide Web Consortium website" href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a> reminds us, there are many types of <acronym title="HyperText Markup Language">HTML</acronym> in use on the internet. To ensure these documents are displayed correctly, the various programs (browsers, mobile phones, <acronym title="Personal Digital Assistant">PDA</acronym>s etc) that view these documents need to know what kind of document structure they contain. These programs look to the Document Type Definition (referred to as a <acronym title="Document Type Definition">DTD</acronym> and commonly called a <acronym title="Document Type Definition">doctype</acronym>).</p>
<p>The <acronym title="Document Type Definition">doctype</acronym> appears as the very first thing on the page that is delivered to the user, allowing the browser agent to make decisions about how to display the page. Whilst a document can still display within a web browser in the absence of a <acronym title="Document Type Definition">doctype</acronym>, defining one implies the document is “well formed” and allows a browser to make assumptions that assist it in rendering correctly. It also prevents the browser from making the wrong assumptions and displaying the document in an unexpected “quirks” mode.</p>
<p>So how do you decide what <acronym title="Document Type Definition">doctype</acronym> to use? Again, the <acronym title="World Wide Web Consortium">W3C</acronym> have provided <a title="Click to view a list of recommended DTDs from the World Wide Web Consortium website" href="http://www.w3.org/QA/2002/04/valid-dtd-list.html#DTD">a list of recommended <acronym title="Document Type Definition">DTD</acronym>s for your document</a> but they don’t offer a lot of guidance to the developer in choosing one. In my opinion it comes down to a question of whether you are creating an <acronym title="HyperText Markup Language">HTML</acronym> or an <acronym title="Extensible HyperText Markup Language">XHTML</acronym> document.</p>
<div class="seeThrough h2Pod "><div class="seeThroughTop"><span class="tl"></span><span class="tr"></span><span class="t"></span></div><div class="seeThroughMiddle"><span class="r"></span><span class="l"></span><span class="m"></span><div class="seeThroughContent">
	<h2>Choosing between <acronym title="HyperText Markup Language">HTML</acronym> and <acronym title="Extensible HyperText Markup Language">XHTML</acronym></h2>
</div></div><div class="seeThroughBottom"><span class="bl"></span><span class="br"></span><span class="b"></span></div></div>

<p>Unless you are going to be serving your documents as “text/xml” and loading them into an XML parser to allow your XML tools to manipulate the page, then there is no reason to develop your documents as <acronym title="Extensible HyperText Markup Language">XHTML</acronym>. A majority of web pages on the internet are <acronym title="HyperText Markup Language">HTML</acronym> &#8211; and this should be the default choice for developing your documents &#8211; especially if your web host is serving your pages as “text/html”.</p>
<div class="seeThrough h2Pod "><div class="seeThroughTop"><span class="tl"></span><span class="tr"></span><span class="t"></span></div><div class="seeThroughMiddle"><span class="r"></span><span class="l"></span><span class="m"></span><div class="seeThroughContent">
	<h2>Frameset, Transitional or Strict?</h2>
</div></div><div class="seeThroughBottom"><span class="bl"></span><span class="br"></span><span class="b"></span></div></div>

<p>If you are developing frameset documents, then the choice is already made for you &#8211; you will use a Frameset <acronym title="Document Type Definition">doctype</acronym>. The rest of the time you should consider using a Strict <acronym title="Document Type Definition">doctype</acronym> which is almost the same as the Transitional <acronym title="Document Type Definition">doctype</acronym>, but with the presentation specific elements removed (deprecated).</p>
<p>The big difference between Transitional and Strict <acronym title="Document Type Definition">doctype</acronym>s is the seperation of the presentation and content layers within the document. The idea is that you use <acronym title="Cascading Style Sheet">CSS</acronym> to define the layout of your document, and rely on well formed <acronym title="HyperText Markup Language">HTML</acronym> to define the content of the document. This ensures that the different programs that may be used to view your document are able to read the content consistently, and apply the appropriate presentation layer (via <acronym title="Cascading Style Sheet">CSS</acronym>).</p>
<div class="seeThrough h2Pod "><div class="seeThroughTop"><span class="tl"></span><span class="tr"></span><span class="t"></span></div><div class="seeThroughMiddle"><span class="r"></span><span class="l"></span><span class="m"></span><div class="seeThroughContent">
	<h2>When should you use a Transitional <acronym title="Document Type Definition">doctype</acronym>?</h2>
</div></div><div class="seeThroughBottom"><span class="bl"></span><span class="br"></span><span class="b"></span></div></div>

<p>The Transitional <acronym title="Document Type Definition">doctype</acronym> is appropriate if you are working on an existing <acronym title="HyperText Markup Language">HTML</acronym> document that contains presentational elements (like the <code>&lt;center&gt;</code>, and <code>&lt;font&gt;</code> tags). These tags were totally acceptable for the older <acronym title="HyperText Markup Language">HTML</acronym> 3.2 definition (where the presentation and content layers were freely combined) and many sites still contain documents that have not been “upgraded” to use the most current standards.</p>
<p>If you are starting a new site, then you should be using a Strict <acronym title="Document Type Definition">doctype</acronym> rather than a Transitional one.</p>
<div class="seeThrough h2Pod "><div class="seeThroughTop"><span class="tl"></span><span class="tr"></span><span class="t"></span></div><div class="seeThroughMiddle"><span class="r"></span><span class="l"></span><span class="m"></span><div class="seeThroughContent">
	<h2>So tell me what to do!</h2>
</div></div><div class="seeThroughBottom"><span class="bl"></span><span class="br"></span><span class="b"></span></div></div>

<p>To summarise, I would suggest that you use the following <acronym title="Document Type Definition">doctype</acronym> for each of the following “common” development scenarios:</p>
<ul>
<li><a title="View the Frameset HTML 4.01 Document Type Definition" href="http://www.w3.org/TR/html401/frameset.dtd">Frameset HTML 4.01</a> &#8211; when maintaining or updating a frameset <acronym title="HyperText Markup Language">HTML</acronym> document</li>
<li><a title="View the Transitional HTML 4.01 Document Type Definition" href="http://www.w3.org/TR/html401/transitional.dtd">Transitional HTML 4.01</a> &#8211; when maintaining or updating an old <acronym title="HyperText Markup Language">HTML</acronym> document that contains deprecated tags</li>
<li><a title="View the Strict HTML 4.01 Document Type Definition" href="http://www.w3.org/TR/html401/strict.dtd">Strict HTML 4.01</a> &#8211; when building a new site which seperates the presentation and content layers</li>
<li><a title="View the Frameset XHTML 1.0 Document Type Definition" href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">Frameset XHTML 1.0</a> &#8211; when maintaining or updating an <acronym title="HyperText Markup Language">HTML</acronym> frameset <acronym title="Extensible HyperText Markup Language">XHTML</acronym> document</li>
<li><a title="View the Transitional XHTML 1.0 Document Type Definition" href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">Transitional XHTML 1.0</a> &#8211; when building or updating a site that needs to support <acronym title="HyperText Markup Language">HTML</acronym> presentation layer tags</li>
<li>Strict XHTML &#8211; when building a new site that will be manipulated by an XML parser and served as “text/xml”</li>
</ul>
<p>The decision of whether to use Strict <acronym title="Extensible HyperText Markup Language">XHTML</acronym> 1.0 or <acronym title="Extensible HyperText Markup Language">XHTML</acronym> 1.1 is left to the reader. If you are developing Strict <acronym title="Extensible HyperText Markup Language">XHTML</acronym> documents and serving them to a wide audience, you should have already made this decision based on the audience and the technology being used to serve (and read/parse) the documents.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codecouch.com/2005/12/how-do-i-choose-a-doctype/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Microsoft finally retires IE 5 for the Mac</title>
		<link>http://www.codecouch.com/2005/12/microsoft-finally-retires-ie-5-for-the-mac/</link>
		<comments>http://www.codecouch.com/2005/12/microsoft-finally-retires-ie-5-for-the-mac/#comments</comments>
		<pubDate>Thu, 15 Dec 2005 11:03:31 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.codecouch.com/?p=122</guid>
		<description><![CDATA[On December 14th 2005, Microsoft quietly published an update onto their web site. They announced they are finally ending all support for Macintosh Internet Explorer as of 31st December 2005 and will not be providing any further security or perfomance updates.]]></description>
			<content:encoded><![CDATA[<p>On December 14th 2005, <a title="Click to visit the main Microsoft website" href="http://www.microsoft.com/">Microsoft</a> quietly published an <a title="Click to read Microsoft's statement about Macintosh Internet Explorer support being dropped" href="http://www.microsoft.com/mac/products/internetexplorer/internetexplorer.aspx?pid=internetexplorer">update onto their web site</a>. They announced they are finally ending all support for <a title="Click to visit the download page for the latest Macintosh Internet Explorer" href="http://www.microsoft.com/mac/downloads.aspx#IE">Macintosh Internet Explorer</a> as of 31st December 2005 and will not be providing any further security or performance updates. Furthermore, the browser will not be available for download from January 31st, 2006. They then go on to actively promote users adopt Apple Safari as a “more recent browsing technology”.</p>
<p>This isn’t really completely new &#8211; it has been in <a title="View Microsoft's Lifecycle Policy document for Macintosh product" href="http://support.microsoft.com/gp/lifemacfaq">Microsoft’s Lifecycle Policy document</a> since at least June 2003 (as seen in <a title="Click to view the CNet news article on this announcement" href="http://news.com.com/2100-1045_3-1017126.html">this CNet news article from June 2003</a>).</p>
<p>When it was <a title="Click to view an article singing the praises of IE5 for the Mac from Alistapart" href="http://www.alistapart.com/articles/ie5mac/">first released in March 2000</a>, version 5.x of IE for the Mac was much more standards compliant than it’s Windows counterpart &#8211; and even though Microsoft ended development over 2 and a half years ago, the browser still performed better at rendering CSS in a consistent fashion than more modern Windows Internet Explorer builds. That’s not to say the Macintosh version wasn’t ready for retirement… and without anyone remaining to develop it… it’s loyal users have quietly migrated away.</p>
<p>We now have Apple’s flagship <a title="Click to visit the Safari product pages at Apple.com" href="http://www.apple.com/safari/">Safari</a> as well as the latest <a title="Click to visit the Firefox website" href="http://www.mozilla.com/firefox/">Firefox</a>, and <a title="Click to visit the Opera website" href="http://www.opera.com/">Opera</a> browsers available for <a title="Click to visit the MacOSX product pages at the Apple website" href="http://www.apple.com/macosx/">MacOSX</a> as well as a dedicated following of less well-known browsers (including <a title="Click to visit the iCab website" href="http://www.icab.de/">iCab</a> and <a title="Click to visit the Camino website" href="http://www.caminobrowser.org/">Camino</a>) that remain in development.</p>
<p>I don’t think the loss of IE is going to be a problem for Mac users and web developers going forward &#8211; it will be good to see it finally drop off the web logs, though.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codecouch.com/2005/12/microsoft-finally-retires-ie-5-for-the-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What is Javascript?</title>
		<link>http://www.codecouch.com/2005/11/what-is-javascript/</link>
		<comments>http://www.codecouch.com/2005/11/what-is-javascript/#comments</comments>
		<pubDate>Sun, 06 Nov 2005 22:16:22 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.codecouch.com/?p=128</guid>
		<description><![CDATA[JavaScript is an object-based scripting programming language based on the concept of prototypes. The language is best known for its use in websites, but is also used to enable scripting access to objects embedded in other applications.]]></description>
			<content:encoded><![CDATA[<p>Partially sourced from <a href="http://en.wikipedia.org/wiki/JavaScript" target="_blank">http://en.wikipedia.org/wiki/JavaScript</a></p>
<p>JavaScript is an object-based scripting programming language based on the concept of prototypes. The language is best known for its use in websites, but is also used to enable scripting access to objects embedded in other applications.</p>
<p>It was originally developed by Brendan Eich of Netscape Communications Corporation under the name Mocha, then LiveScript, and finally renamed to JavaScript.</p>
<p>JavaScript has a C-like syntax.</p>
<p>Here is a short list of some things that Javascript is <b>not</b>:</p>
<ul<li>Javascript is not Java</li>
<li>Javascript is not C</li>
<li>Javascript is not HTML, XHTML or XML</li>
</ul>
<p>Typically we use Javascript as a <b>client-side</b> scripting programming language to perform HTML form validation, navigation &#8220;roll-overs&#8221; and to enhance usability. All these tasks are performed on the web browser &#8211; after the page has been processed by a web server and delivered to the (remote) web browser.</p>
<p>It is possible to change ASP (Active Server Pages &#8211; part of Microsoft IIS) to use Javascript server-side (rather than VBScript), and in this context the Javascript is run server-side before the page is delivered to the (remote) web browser.</p>
<p>Regardless of the server-side technology you are using, the page is processed server-side first, and then it is passed to the client (where it can be affected by Javascript running client-side). This is a one-way action (the web server cannot continue to process server-side once the contents of the page have been delivered to the browser).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codecouch.com/2005/11/what-is-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
