<?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>LogikDevelopment &#187; old browsers</title>
	<atom:link href="http://www.logikdev.com/tag/old-browsers/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.logikdev.com</link>
	<description>&#34;Il n&#039;y a pas de problème, il n&#039;y a que des solutions. L&#039;esprit de l&#039;homme invente ensuite le problème.&#34; André Gide</description>
	<lastBuildDate>Tue, 20 Dec 2011 12:25:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Be careful of SKIP_COMMENTS</title>
		<link>http://www.logikdev.com/2009/12/01/be-careful-of-skip_comments/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=be-careful-of-skip_comments</link>
		<comments>http://www.logikdev.com/2009/12/01/be-careful-of-skip_comments/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 20:25:33 +0000</pubDate>
		<dc:creator>smoreau</dc:creator>
				<category><![CDATA[Tricks]]></category>
		<category><![CDATA[Facelets]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[old browsers]]></category>
		<category><![CDATA[SKIP_COMMENTS]]></category>

		<guid isPermaLink="false">http://www.logikdev.com/?p=147</guid>
		<description><![CDATA[In the early days, we used to hide JavaScript code from old browsers that do not support JavaScript. The way of doing this was to put a one-line HTML-style comment without the closing characters immediately after the opening &#60;script&#62; tag and put //--&#62; at the end of the script. For example: However if you are [...]]]></description>
			<content:encoded><![CDATA[<p>In the early days, we used to hide JavaScript code from old browsers that do not support JavaScript.<br />
The way of doing this was to put a one-line HTML-style comment without the closing characters immediately after the opening <code>&lt;script&gt;</code> tag and put <code>//--&gt;</code> at the end of the script.</p>
<p>For example:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
alert('Test');
//--&gt;
&lt;/script&gt;
</pre>
<p>However if you are using this trick with the initialization parameter <code>facelets.SKIP_COMMENTS</code> set to <strong>true</strong>, the code between <code>&lt;!--</code> and <code>//--&gt;</code> won&#8217;t even be sent to the client!<br />
It simply means that the code above won&#8217;t open an alert window because it has been skipped during the page rendering.</p>
<p>Here is what the client will receive:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
//--&gt;
&lt;/script&gt;
</pre>
<p><br/>You have two solutions to avoid this situation:</p>
<ol>
<li>Set the <code>SKIP_COMMENTS</code> parameter to false (the default is true). This can&#8217;t really hurt, your page will just be heavier depending on how much HTML comments you put on your page;</li>
<li>No need to hide the JavaScript code as all browsers are now supporting it and over 99.9% of users have it enabled &#8211; this is the solution I chose.</li>
</ol>
<p>For information, below is the code to put in your web.xml file to set the <code>SKIP_COMMENTS</code> parameter to false:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;context-param&gt;
    &lt;param-name&gt;facelets.SKIP_COMMENTS&lt;/param-name&gt;
    &lt;param-value&gt;false&lt;/param-value&gt;
&lt;/context-param&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.logikdev.com/2009/12/01/be-careful-of-skip_comments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

