<?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>cotsweb.com Blog &#187; javascript</title>
	<atom:link href="http://www.cotsweb.com/blog/category/web-design/javascript/feed" rel="self" type="application/rss+xml" />
	<link>http://www.cotsweb.com/blog</link>
	<description>Web design, Website development and life in the Cotswolds</description>
	<lastBuildDate>Mon, 23 Jan 2012 13:40:45 +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>How many people have javaScript disabled in their browsers ? Revisited</title>
		<link>http://www.cotsweb.com/blog/how-many-people-have-javascript-disabled-in-their-browsers-revisited-217.html</link>
		<comments>http://www.cotsweb.com/blog/how-many-people-have-javascript-disabled-in-their-browsers-revisited-217.html#comments</comments>
		<pubDate>Mon, 09 May 2011 13:47:31 +0000</pubDate>
		<dc:creator>cotsweb</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Search Engine Optimisation]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[javaScript]]></category>

		<guid isPermaLink="false">http://www.cotsweb.com/blog/?p=217</guid>
		<description><![CDATA[A little while ago I tried to devise a reliable method for figuring out what proportion of browsers had javaScript disabled.  My method sort of worked but then I discovered that Awstats (which is installed on all my sites) had a facility for determining whether visitors had javaScript disabled or not.  To activate this functionality [...]]]></description>
			<content:encoded><![CDATA[<p>A little while ago I tried to devise a reliable method for figuring out <a title="How many people have javaScript disabled in their browsers?" href="http://www.cotsweb.com/blog/how-many-people-have-javascript-disabled-in-their-browsers-161.html">what proportion of browsers had javaScript disabled</a>.  My method sort of worked but then I discovered that Awstats (which is installed on all my sites) had a facility for determining whether visitors had javaScript disabled or not.  To activate this functionality I needed to<a title="How to install the aw_stats_misc_tracker to track how many people have javaScript disabled." href="http://awstats.sourceforge.net/docs/awstats_faq.html#SCREENSIZE"> install the awstats_misc_tracker</a> which was fairly straight forward, from then on I have been collecting the necessary data.</p>
<p>The results?  After nearly 2 months of tracking I can say that about 2.5% have javaScript disabled, or 97.5% have javaScript enabled.</p>
<p>The website I have been tracking is  a <a title="Accommodation, Eating out and shopping in Stow on the Wold" href="http://www.stowonthewold.info">business and visitor guide to Stow on the Wold</a>.  I chose this site because it is fairly busy (about 4000 visitors per month) and because it very much a general purpose website with a wide cross-section of visitors.  I suspect that a more technical site might show more people with javaScript disabled, my theory is that most people don&#8217;t want to disable javaScript and wouldn&#8217;t know how to disable it if they did want to.</p>
<p>Update 21st December 2011 &#8211; A few more months of data show the percentage with javaScript disabled fairly steady at about 3%.   So about 97% of my visitors have javaScript enabled which is useful to know.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cotsweb.com/blog/how-many-people-have-javascript-disabled-in-their-browsers-revisited-217.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How many people have javaScript disabled in their browsers?</title>
		<link>http://www.cotsweb.com/blog/how-many-people-have-javascript-disabled-in-their-browsers-161.html</link>
		<comments>http://www.cotsweb.com/blog/how-many-people-have-javascript-disabled-in-their-browsers-161.html#comments</comments>
		<pubDate>Wed, 25 Aug 2010 14:15:46 +0000</pubDate>
		<dc:creator>cotsweb</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[javaScript]]></category>

		<guid isPermaLink="false">http://www.cotsweb.com/blog/?p=161</guid>
		<description><![CDATA[cotsweb is running a little trial to answer the question What percentage of browsers have javaScript enabled?. This site isn&#8217;t busy enough to give a useful answer but we are using it as a trial to make sure that our method works and that it doesn&#8217;t mess up the existing site before rolling it out [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.cotsweb.com">cotsweb</a> is running a little trial to answer the question <em>What percentage of browsers have javaScript enabled?</em>.  This site isn&#8217;t busy enough to give a useful answer but we are using it as a trial to make sure that our method works and that it doesn&#8217;t mess up the existing site before rolling it out to a busier site.</p>
<h3>Method</h3>
<p>It&#8217;s quite simple in principle.  When a user loads one of the pages we are using for this test several things happen:</p>
<ol>
<li>A PHP script creates a session on the server and logs this in a mySQL database</li>
<li>If no session exists already then the PHP script writes a little bit of javascript into the HTML page to be served</li>
<li>If the client has javaScript enabled on their computer the script will run sending an asynchronous call (to avoid slowing down the pageload while waiting for a response from the server) to the server</li>
<li>Another PHP script on the server will find the mySQL record created in step one and update the javascript_enabled flag</li>
<li>If the client doesn&#8217;t have javaScript enabled then the script won&#8217;t run and the database will not be updated</li>
</ol>
<h3>Results</h3>
<p>So far we have checked <strong>20202</strong> sessions and <strong>1314</strong> of them have had javaScript enabled, a rate of <strong>6.5%</strong>.</p>
<p>We will give this trial a little time and a bit of analysis before we roll this out for some proper results (and publish the code so other people can do the same). </p>
<p><strong>Edit:</strong> Well the first change was to exclude robots, Googlebot and Slurp from Yahoo! were very quick on the scene and of course they don&#8217;t use javaScript.</p>
<p><strong>Further Edit: 31st Aug 2010 </strong> The second change was to remove the logging from this page, it seems like my little script was interfering with something in the header of the blog page, perhaps Google Analytics.<br />
 I am suspicious about the very low percentage of javaScript we are seeing, further investigation is required.  It could be that people are reading this post through feed readers rather than directly and so not activating the script.</p>
<p><strong>Further Edit: 6th Sep 2010</strong> Something isn&#8217;t right here, the logging works for me but the numbers look far too low.  I wonder if there is something wrong with my javaScript code (I am no javaScript expert) which is causing it not to make the ajax call for most people.  This is the code that is included into the header of the testing page:<br />
<pre><code>
&lt;script type=&quot;text/javascript&quot;&gt;
// 
// This script is part of my javascript logging routine.
// If javascript is enabled it sends a request to the server which will log the fact that javascript is enabled.
// 
// The cunning bit which copes with the fact that IE6 doesn&#039;t know about XMLHttpRequest, thanks to
// http://ajax-prototype.blogspot.com/2007/02/workaround-to-make-ajax-calls-on.html
//
if (!window.XMLHttpRequest) {
&nbsp;&nbsp;window.XMLHttpRequest = function() {
&nbsp;&nbsp;&nbsp;&nbsp;return new ActiveXObject(&#039;Microsoft.XMLHTTP&#039;);
&nbsp;&nbsp;&nbsp;&nbsp;} 
}
//
// Send the PHP session_id to the server script so it can update the log record for this session
//
request=new XMLHttpRequest();
request.open(&quot;GET&quot;,&quot;http://www.cotsweb.com/update_javascript_log.php?session_id=&amp;lt;?php echo(session_id()); ?gt; ,true);
request.send(null);
&lt;/script&gt;</code></pre></p>
<p>Perhaps someone else can see what I have done wrong?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cotsweb.com/blog/how-many-people-have-javascript-disabled-in-their-browsers-161.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Google Chrome Frame &#8211; Hope for IE users?</title>
		<link>http://www.cotsweb.com/blog/google-chrome-frame-hope-for-ie-users-92.html</link>
		<comments>http://www.cotsweb.com/blog/google-chrome-frame-hope-for-ie-users-92.html#comments</comments>
		<pubDate>Thu, 24 Sep 2009 13:15:42 +0000</pubDate>
		<dc:creator>cotsweb</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[Chrome]]></category>
		<category><![CDATA[internet explorer]]></category>

		<guid isPermaLink="false">http://www.cotsweb.com/blog/?p=92</guid>
		<description><![CDATA[Google have just announced a new browser plugin called Google Chrome Frame.  The unusual thing about Chrome Frame is that it isn&#8217;t a plugin for Chrome (Google&#8217;s own browser), it&#8217;s a plugin for Internet Explorer!  It should work with any of the current versions, IE6, IE7 &#38; IE8. What Chrome Frame does is tell Internet [...]]]></description>
			<content:encoded><![CDATA[<p>Google have just announced a new browser plugin called <a title="Google Chrome Frame plugin for Internet Explorer" href="http://blog.chromium.org/2009/09/introducing-google-chrome-frame.html">Google Chrome Frame</a>.  The unusual thing about Chrome Frame is that it isn&#8217;t a plugin for Chrome (Google&#8217;s own browser), it&#8217;s a plugin for Internet Explorer!  It should work with any of the current versions, IE6, IE7 &amp; IE8.</p>
<p>What Chrome Frame does is tell Internet Explorer to use  Chrome&#8217;s rendering engine (Webkit) rather than IE&#8217;s own rendering engine.  The benefit for the user is faster browsing, particularly when a website uses Javascript, Chrome&#8217;s javascript module is much faster than IE&#8217;s equivalent.  The benefit for the website developer is that Chrome is a good modern browser, standards compliant and supporting a lot  of newer features such as HTML 5 &amp; CSS2/3 which are not even supported in IE8.</p>
<p>The theory is that if a web page works in Chrome then it will work in IE with Chrome Frame.  Chrome Frame  is still very new so they are not quite there yet but I&#8217;m sure they will get there.   All those IE specific problems which website designers have had to work around for years, including those still hanging around from IE6, will become a thing of the past.  Wonderful!</p>
<h2>But will people use it?</h2>
<p>The problem is that Chrome Frame, being a plugin for IE, has to be installed by the user.  Do you remember the bad old days when it seemed that every new site required a new plugin?  Once the user has installed Chrome Frame all will be well but that first installation is the sticking point.</p>
<p>As a webdesigner I can put a piece of code on any of my websites which pops up a window giving an IE user the option to install Chrome Frame so they can view the site properly, but I don&#8217;t really want to do that.  People are, and should be, wary of installing things when asked to do so by a website.  And I don&#8217;t want people to navigate away from my site because it is too scary or demanding.  In any case most sites work fine  in IE anyway so why do they need to install a plugin?</p>
<p>My real hope is that  corporate IT installations might think that installing Chrome Frame to upgrade IE6 would be a good idea.  <a title="Why we can't ignore Internet Exlorer 6 " href="http://www.cotsweb.com/blog/ie6-is-the-most-popular-browser-in-the-world-74.html">IE6 is currently the most popular browser in the world</a>, largely because there is no reason for the big corporates to change to anything else.   But a plugin might be different, any existing applications will continue to work fine but new applications could use newer features without the extra coding needed to cope with  the particular quirks found in IE6.  It could be quite a money saver.</p>
<h2>Critical Mass</h2>
<p>I will be monitoring my Google Analytics reports for the day when I see &#8220;unChromed&#8221; IE6 usage drop below 5%.   I think that will be the time to put the plugin code on my own sites.  And when it drops below 2% I will consider ignoring IE6 all together, a happy prospect.</p>
<p>In the meantime I will carry on as usual, coding around the quirks in IE6 and ignoring the other features I might use if IE7 &amp; IE8 supported them.</p>
<p><em><strong>I wonder what Microsoft think about Google writing a plugin for them?</strong></em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cotsweb.com/blog/google-chrome-frame-hope-for-ie-users-92.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding custom icons to Google Maps</title>
		<link>http://www.cotsweb.com/blog/adding-custom-icons-to-google-maps-20.html</link>
		<comments>http://www.cotsweb.com/blog/adding-custom-icons-to-google-maps-20.html#comments</comments>
		<pubDate>Sun, 01 Feb 2009 16:42:34 +0000</pubDate>
		<dc:creator>cotsweb</dc:creator>
				<category><![CDATA[Google Maps]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Browsers]]></category>
		<category><![CDATA[icons]]></category>
		<category><![CDATA[shadows]]></category>
		<category><![CDATA[titles]]></category>

		<guid isPermaLink="false">http://cotsweb.com/blog/?p=20</guid>
		<description><![CDATA[I have just been putting together a website  for Stow-on-the-Wold&#8217;s Cotswold Festival in September 2009.  One of the pages includes a map of Stow showing the Town Square and the various parking options for the festival.  I used Google Maps for this page. Now Google Maps is a wonderful product, very powerful and well documented, [...]]]></description>
			<content:encoded><![CDATA[<p>I have just been putting together a website  for<a title="The Cotswold Festival in Stow on the Wold" href="http://www.cotswoldfestival.com" target="_blank"> Stow-on-the-Wold&#8217;s Cotswold Festival</a> in September 2009.  One of the pages includes a map of Stow showing the Town Square and the various parking options for the festival.  I used Google Maps for this page.</p>
<p>Now Google Maps is a wonderful product, very powerful and well documented, but I don&#8217;t always find it easy to figure out how to do what I want to do.  So I thought I&#8217;d try to make it easier for next time by documenting the issues I came across.</p>
<p>My first problem was creating custom icons for the carparks, I found a suitable graphic but Google Maps has a very smart shadow associated with each icon.  Fortunately I found <a title="Google Maps API icon shadowmaker" href="http://www.cycloloco.com/shadowmaker/" target="_blank">shadowmaker</a> which made creating the shadow effect very simple indeed, it even provided the code to be included in my webpage.  Thank you very much to Erwin Bolwidt!</p>
<p>Next I wanted to display the custom icon but with a tooltip type title which would give some descriptive text when a mouse rolled over the icon.  Both the icon and the title are options for GMarker, but I had some trouble figuring out how to include more than one option (I&#8217;m not very bright really).  The solution is quite straight forward really, just create a new variable which contains all the options (I could also have listed the options in the new GMarker call but that would have been messy).  As you can see I took the opportunity to add a 3rd option to make the icon non-clickable.<br />
<pre><code>
// Place parking icon for Maugersbury Road
var Parking3Opts = {title: &quot;Pay and display car parking on Maugersbury Road&quot;,
clickable: false,
icon: Picon};
var Parking3Coordinates = new GLatLng(51.927500, -1.718300);     /* position of carpark */
map.addOverlay(new GMarker(Parking3Coordinates, Parking3Opts)); </code></pre></p>
<p>That was the map sorted out but I wanted to add a little legend outside the map.  Obviously putting in my</p>
<p><img class="size-full wp-image-23" title="carparkicon1" src="http://cotsweb.com/blog/wp-content/uploads/2009/02/carparkicon1.jpg" alt="Icon for car parks on my Google Map" width="24" height="24" /> icon on the page wasn&#8217;t a problem, I had a copy of that.  But the default GMarker for Google Maps was more elusive, I had real trouble finding a copy of it.  Eventually I did find one <a title="Google Maps default icon image" href="http://www.korben.info/ajouter-google-maps-a-votre-site-en-moins-de-10-min.html" target="_blank">here</a> , thank you Korben. So I include a copy of Korben&#8217;s image here so others can download it <img class="alignnone size-full wp-image-24" title="gmarker" src="http://cotsweb.com/blog/wp-content/uploads/2009/02/gmarker.png" alt="gmarker" width="24" height="38" />I&#8217;m sure the icon is available from Google somewhere but I couldn&#8217;t find it.</p>
<p>That was it for my map (so far), I hope that this makes the process a little easier for the next person who is mystified by the Google Maps API.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cotsweb.com/blog/adding-custom-icons-to-google-maps-20.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Google Analytics to track click throughs from your website</title>
		<link>http://www.cotsweb.com/blog/using-google-analytics-to-track-click-throughs-from-your-website-7.html</link>
		<comments>http://www.cotsweb.com/blog/using-google-analytics-to-track-click-throughs-from-your-website-7.html#comments</comments>
		<pubDate>Fri, 16 May 2008 13:48:12 +0000</pubDate>
		<dc:creator>cotsweb</dc:creator>
				<category><![CDATA[click tracking]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Search Engine Optimisation]]></category>
		<category><![CDATA[clickthru]]></category>
		<category><![CDATA[Google Analytics]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[tracking]]></category>

		<guid isPermaLink="false">http://cotsweb.com/blog/?p=7</guid>
		<description><![CDATA[The Problem It has always been difficult to track when someone clicks a link on your website which takes them to an external website (a click through or clickthru if you prefer). The problem is that the resulting request is made to the external website and is logged there, it doesn&#8217;t get logged on your [...]]]></description>
			<content:encoded><![CDATA[<h2>The Problem</h2>
<p>It has always been difficult to track when someone clicks a link on your website which takes them to an external website (a click through or clickthru if you prefer).  The problem is that the resulting request is made to the external website and is logged there, it doesn&#8217;t get logged on your own website at all.</p>
<p>For the web designer wanting to log clickthrus this is a problem, the traditional answer is to put the code which opens the new site in a file.  When the user clicks on a link some code is executed locally (and logged locally) which then makes the call to the external site.  This works fine but it makes it quite difficult for search engines to follow the link to the external site, sometimes impossible.  If Google can&#8217;t follow the link to the external site then you may be giving them visitors but you are not helping their page rank in Google.</p>
<p>This is obviously a problem that many clever people have been thinking about for some time, one of the best solutions I have found is <a title="Search Engine Friendly Click Tracking" href="http://http://www.smart-it-consulting.com/article.htm?node=155&amp;page=96" target="_blank">Search Engine Friendly Click Tracking</a> which uses javascript to log any click on a link to a file or database.</p>
<h2>The solution</h2>
<p>But while checking some details in Google Analytics I found a section on <a title="Google Analytics using javascript events to trackout outgoing page views" href="http://www.google.com/support/analytics/bin/static.py?page=troubleshooter.cs&amp;problem=tracking&amp;selected=tracking_outbound&amp;ctx=tracking_tracking_outbound_55527&amp;aw_referral=" target="_blank">using javascript events to track outbound pageviews</a>.    This is essentially the same technique as mentioned above but integrated with Google Analytics rather than standalone.   It seems to me that this little feature using the new version of the Google Analytics tracking code is the holy grail of Search Engine Optimisation!</p>
<p><img src="http://www.cotsweb.com/blog/images/King_Arthurs_Grail_Vision.jpg" alt="King Arthur sees a vision of Google Analytics" /></p>
<p>All you need to do is;</p>
<ol>
<li>make sure that you are using the new version of the Google Analytics Tracking code.</li>
<li>That the code is inserted in your webpage above any links that you want to track (I put it just after the &lt;body&gt; tag in my test page).</li>
<li>Add a javascript event tag to each link you want to track.</li>
</ol>
<p>The actual tag is quite simple, this is Google&#8217;s example;</p>
<blockquote>
<p style="text-align: left;"><span style="font-family: Courier New,Courier,mono;">&lt;a href=&#8221;http://www.example.co.uk&#8221; <strong>onClick=&#8221;javascript: pageTracker._trackPageview (&#8216;/outgoing/example.co.uk&#8217;);</strong>&#8220;&gt;</span></p>
</blockquote>
<p>When somebody clicks on the link Google Analytics will log the click as a call to /outgoing/example.co.uk in your analytics report.</p>
<p>And of course the href code is retained in its natural form so it is easy for search engines to follow the link, you can give the target site the link love it deserves.</p>
<p>I think this is a brilliant development, a big thank you to the wizards at Google for their continued good work!</p>
<h2>Bonuses from Google Analytics</h2>
<h3>Using Goals to monetize outbound links</h3>
<p>In Google Analytics you can assign goals to pages which make you money, say the checkout page on your shop.  You can do the same thing with your new trackable outbound links, so if you carry advertising on your site you can see exactly how much you are earning.    You could assign a value of say 10p to any pageview in the /outgoing/ directory and use Google Analytics to work out your bills.</p>
<h3>Tracking calls to images and PDF files</h3>
<p>Also, this technique can be applied to any sort of link.  I discovered it while looking for a why of tracking views of a PDF file.   If you have a file, like a PDF or an image, where you can&#8217;t insert the Google Analytics code inside the file then you can do something like;</p>
<blockquote>
<p style="text-align: left;"><span style="font-family: Courier New,Courier,mono;">&lt;a href=&#8221;http://www.example.co.uk&#8221; <strong>onClick=&#8221;javascript: pageTracker._trackPageview (&#8216;/my_document.pdf&#8217;);</strong>&#8220;&gt;</span></p>
</blockquote>
<p>And you can track views of the PDF or image file just like they were a regular web page.</p>
<h2>Thank you Google</h2>
<p>Thank you to Google for another great tool.  Now that I know the answer I have no trouble finding the solution with a search in Google but I hope this article saves someone else some time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cotsweb.com/blog/using-google-analytics-to-track-click-throughs-from-your-website-7.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

