<?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>gregs &#187; browser</title>
	<atom:link href="http://gregs.tcias.co.uk/category/comps/browser/feed/" rel="self" type="application/rss+xml" />
	<link>http://gregs.tcias.co.uk</link>
	<description>helping me remember what I figure out</description>
	<lastBuildDate>Sun, 13 Jun 2010 02:16:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Goosh</title>
		<link>http://gregs.tcias.co.uk/2008/06/03/goosh/</link>
		<comments>http://gregs.tcias.co.uk/2008/06/03/goosh/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 01:43:15 +0000</pubDate>
		<dc:creator>gregs</dc:creator>
				<category><![CDATA[*nix]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[tumble]]></category>

		<guid isPermaLink="false">http://gregs.tcias.co.uk/?p=469</guid>
		<description><![CDATA[The unofficial Google Shell&#8230; I like it!
]]></description>
			<content:encoded><![CDATA[<p><a title="The unofficial Google shell" href="http://goosh.org/">The unofficial Google Shell</a>&#8230; I like it!</p>
]]></content:encoded>
			<wfw:commentRss>http://gregs.tcias.co.uk/2008/06/03/goosh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reflow</title>
		<link>http://gregs.tcias.co.uk/2008/05/30/reflow/</link>
		<comments>http://gregs.tcias.co.uk/2008/05/30/reflow/#comments</comments>
		<pubDate>Fri, 30 May 2008 04:27:42 +0000</pubDate>
		<dc:creator>gregs</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[rendering]]></category>

		<guid isPermaLink="false">http://gregs.tcias.co.uk/?p=468</guid>
		<description><![CDATA[Or more appropriately what is it? Fascinating&#8230;
]]></description>
			<content:encoded><![CDATA[<p>Or more appropriately <a title="What is reflow" href="http://dougt.wordpress.com/2008/05/24/what-is-a-reflow/">what is it</a>? Fascinating&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://gregs.tcias.co.uk/2008/05/30/reflow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>stopping a page refresh</title>
		<link>http://gregs.tcias.co.uk/2005/10/21/stopping-a-page-refresh/</link>
		<comments>http://gregs.tcias.co.uk/2005/10/21/stopping-a-page-refresh/#comments</comments>
		<pubDate>Wed, 30 Nov -0001 00:00:00 +0000</pubDate>
		<dc:creator>gregs</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[browser]]></category>

		<guid isPermaLink="false">http://gregs.tcias.co.uk/?p=151</guid>
		<description><![CDATA[I found myself having to trap a user attempting to refresh a page for one of our web apps. After a little bit of digging I stumbled across this solution:
PLAIN TEXT
CODE:




&#60;script type="text/javascript"&#62; 


&#60;!-- 


window.onbeforeunload = unloadMess; 


function unloadMess&#40;&#41;


&#123;


&#160;&#160; &#160;mess = "You are about to refresh the screen and will loose all of your changes.nAre you [...]]]></description>
			<content:encoded><![CDATA[<p>I found myself having to trap a user attempting to refresh a page for one of our web apps. After a little bit of digging I stumbled across <a href="http://webreference.com/dhtml/diner/beforeunload/bunload4.html" title="The IE onBeforeUnload Event Handler">this solution</a>:</p>
<div class="igBar"><span id="lcode-2"><a href="#" onclick="javascript:showPlainTxt('code-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-2">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;script type=<span style="color:#CC0000;">"text/javascript"</span>&gt; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;!-- </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">window.<span style="">onbeforeunload</span> = unloadMess; </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">function unloadMess<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;&nbsp; &nbsp;mess = <span style="color:#CC0000;">"You are about to refresh the screen and will loose all of your changes.nAre you sure you want to do so?"</span> &nbsp; return mess; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//--&gt; </span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;/script&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>To use it simply embed or include it into your template</p>
<p>Eventhough the article says this is a IE specific event/feature it also works in FireFox. You should be aware that whenever the user leaves the page, they will be prompted about their impeding data loss, which can get a little tedious while developing.</p>
<p>Again this became a handy feature for our AJAX apps as most of the processing is done in the background without the page reload, a user could accidentally hit the back button and loose where they were at.</p>
]]></content:encoded>
			<wfw:commentRss>http://gregs.tcias.co.uk/2005/10/21/stopping-a-page-refresh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Conditional compilation</title>
		<link>http://gregs.tcias.co.uk/2005/08/23/conditional-compilation/</link>
		<comments>http://gregs.tcias.co.uk/2005/08/23/conditional-compilation/#comments</comments>
		<pubDate>Wed, 30 Nov -0001 00:00:00 +0000</pubDate>
		<dc:creator>gregs</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[browser]]></category>

		<guid isPermaLink="false">http://gregs.tcias.co.uk/?p=144</guid>
		<description><![CDATA[What with the buzz going on around xmlHttpRequest, I decided to have a little play with the technology (yes I know very me too of me). One tutorial/example site I stumbled across "Guide to Using XMLHttpRequest (with Baby Steps)" used some interesting JavaScript: Conditional Compilation. Here is an example:
PLAIN TEXT
JavaScript:




/*@cc_on @*/


/*@if (@_jscript_version&#38;gt;= 4)


alert(&#34;JScript version 4 [...]]]></description>
			<content:encoded><![CDATA[<p>What with the buzz going on around xmlHttpRequest, I decided to have a little play with the technology (yes I know very me too of me). One tutorial/example site I stumbled across "<a href="http://www.webpasties.com/xmlHttpRequest/" title="Guide to Using XMLHttpRequest (with Baby Steps)">Guide to Using XMLHttpRequest (with Baby Steps)</a>" used some interesting JavaScript: <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/js56jsconconditionalcompilation.asp" title="Conditional Compilation">Conditional Compilation</a>. Here is an example:</p>
<div class="igBar"><span id="ljavascript-4"><a href="#" onclick="javascript:showPlainTxt('javascript-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JavaScript:</span>
<div id="javascript-4">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">/*@cc_on @*/</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">/*@if (@_jscript_version&amp;gt;= 4)</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">alert(&quot;JScript version 4 or better&quot;);</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">@else @*/</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000066;">alert</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"You need a more recent script engine."</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">/*@end @*/</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>From the looks of it, it's an IE only thing, but I wonder what the advantages are of using this code over a regular browser check? Is this a more reliable way than using <em>window.ActiveXObject</em> and, if you are specifically playing around with xmlHttpRequest, based on that condition making the correct create object call?</p>
]]></content:encoded>
			<wfw:commentRss>http://gregs.tcias.co.uk/2005/08/23/conditional-compilation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatic checkbox selection</title>
		<link>http://gregs.tcias.co.uk/2000/10/18/javascript-automatic-checkbox-selection/</link>
		<comments>http://gregs.tcias.co.uk/2000/10/18/javascript-automatic-checkbox-selection/#comments</comments>
		<pubDate>Wed, 30 Nov -0001 00:00:00 +0000</pubDate>
		<dc:creator>gregs</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[browser]]></category>

		<guid isPermaLink="false">http://gregs.tcias.co.uk/?p=288</guid>
		<description><![CDATA[Imagine a situation where you have a search form, with different search options based on different categories (such as Search all, news, weather, entertainment, etc...). Now when you submit your form you won't users to either select the Search All option or the different categories, but not both (i.e. the form is to be cleared [...]]]></description>
			<content:encoded><![CDATA[<p>Imagine a situation where you have a search form, with different search options based on different categories (such as Search all, news, weather, entertainment, etc...). Now when you submit your form you won't users to either select the <strong>Search All</strong> option or the <strong>different categories</strong>, but not both (i.e. the form is to be cleared of all the <strong>different categories</strong> if <strong>Search All</strong> is selected and vice versa when you select a <strong>different category</strong> the <strong>Search All</strong> option is to be cleared). In the following I will talk you through a script I wrote to achieve just that effect.</p>
<p>Let's start off with the actual form:</p>
<p><em>&lt;form name="example" action="&lt;your destination page&gt;"&gt;<br />
&lt;input type="Checkbox" name="test" onclick="javascript:SetOther()" checked&gt; Search All<br />
&lt;input type="Checkbox" name="test2" onclick="javascript:SetAll()"&gt; News<br />
&lt;input type="Checkbox" name="test2" onclick="javascript:SetAll()"&gt; Weather<br />
&lt;input type="Checkbox" name="test2" onclick="javascript:SetAll()"&gt; Entertainment<br />
&lt;input type="Checkbox" name="test2" onclick="javascript:SetAll()"&gt; Music<br />
&lt;input type="Submit" value="Search"&gt;<br />
&lt;/form&gt;</em></p>
<p>For the script to work it is very important to give the form a name so that the JS can reference the script. Else there is nothing special about the <strong>&lt;Form&gt;</strong> tag. The checkboxes contain all <em>onclick</em> event handlers and they call different functions (to carry out different actions, more on that when we review the script). Also note that the <strong>different categories</strong> checkboxes have the same name. The final component is the search button.</p>
<p>Now let's look at the script:</p>
<p><em>&lt;SCRIPT LANGUAGE="JavaScript"&gt;<br />
&lt;!-- hide script from older browsers<br />
function SetAll() {<br />
&nbsp;&nbsp;&nbsp;dml = document.example;<br />
&nbsp;&nbsp;&nbsp;len = dml.elements.length;<br />
&nbsp;&nbsp;&nbsp;val = 0;<br />
&nbsp;&nbsp;&nbsp;var i = 0;<br />
&nbsp;&nbsp;&nbsp;for(i = 0; i&lt;len; i++) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (dml.elements[i].name == 'test2') {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dml.test.checked = val;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;}<br />
}<br />
function SetOther() {<br />
&nbsp;&nbsp;&nbsp;dml = document.example;<br />
&nbsp;&nbsp;&nbsp;len = dml.elements.length;<br />
&nbsp;&nbsp;&nbsp;val = 0;<br />
&nbsp;&nbsp;&nbsp;var i = 0;<br />
&nbsp;&nbsp;&nbsp;for(i = 0; i&lt;len; i++) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (dml.elements[i].name == 'test2') {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dml.elements[i].checked = val;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;}<br />
}<br />
--&gt;<br />
&lt;/script&gt;</em></p>
<p>Right let's take a look at the first function, called <em>SetAll</em>. This functions controls the behaviour of the <strong>Search All</strong> checkbox, i.e. if the any of the <strong>different categories</strong> checkboxes are ticked remove the check for <strong>Search All</strong> checkbox. On the first three lines of that function I set a bunch of variables to make the coding easier (i.e. shorter). The variable <em>dml</em> stores the form name, <em>len</em> stores the number of elements elements (checkboxes) of said form, <em>val</em> is set <em>0</em> and I also set <em>i</em> to <em>0</em>. Next I looped (<em>for</em> statement) over the number of elements, checking which elements named <em>test2</em> are checked (<em>if</em> statement). Now you can see why I gave the form elements for <strong>different categories</strong> the same name, because the behaviour dictated that if any of the <strong>different categories</strong> is checked the script was to remove the check from <em>Search All</em>. The statement between the if clause does exactly that, it sets for element <em>test</em> to <em>val</em>, which is <em>0</em>.</p>
<p>The second function displays a similar behaviour. The difference is that when the <strong>Search All</strong> checkbox is ticked, the tick in all the other categories is removed. I hope all this made sense and that you found it useful, so until the next time!!</p>
]]></content:encoded>
			<wfw:commentRss>http://gregs.tcias.co.uk/2000/10/18/javascript-automatic-checkbox-selection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
