<?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>Ten Tonne Baby &#187; javascript</title>
	<atom:link href="http://www.tentonnebaby.com/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tentonnebaby.com</link>
	<description>Discussion on Web Technologies, Design and London</description>
	<lastBuildDate>Wed, 07 Jul 2010 20:58:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>HTML 5 data- attributes</title>
		<link>http://www.tentonnebaby.com/2010/02/02/html-5-data-attributes/</link>
		<comments>http://www.tentonnebaby.com/2010/02/02/html-5-data-attributes/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 10:28:11 +0000</pubDate>
		<dc:creator>Oli</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.tentonnebaby.com/2010/02/02/html-5-data-attributes/</guid>
		<description><![CDATA[One welcome addition to the proposed HTML5 specification is to allow any attribute prefixed with data- to be treated as a storage area for private data. This makes it possible to associate private data with different DOM elements when a page is generated and sent from the server while still validating against an HTML validator.
Previously [...]]]></description>
			<content:encoded><![CDATA[<p>One welcome addition to the proposed HTML5 specification is to allow any attribute prefixed with <strong>data-</strong> to be treated as a storage area for private data. This makes it possible to associate private data with different DOM elements when a page is generated and sent from the server while still validating against an HTML validator.</p>
<p>Previously it has been possible to temporarily store state information in custom properties against an element via javascript, however embedding state information in a page when generated server-side (and getting a page to validate) always required workarounds. I’ve often resorted to using hidden input elements to expose state information to client-side script, but this should not (and won’t any longer) be necessary.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tentonnebaby.com/2010/02/02/html-5-data-attributes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Problems having a simple, self-contained script with dependencies</title>
		<link>http://www.tentonnebaby.com/2009/12/16/problems-having-a-simple-self-contained-script-with-dependencies/</link>
		<comments>http://www.tentonnebaby.com/2009/12/16/problems-having-a-simple-self-contained-script-with-dependencies/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 16:37:50 +0000</pubDate>
		<dc:creator>Oli</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[typekit]]></category>

		<guid isPermaLink="false">http://www.embeddedstream.com/2009/12/16/problems-having-a-simple-self-contained-script-with-dependencies/</guid>
		<description><![CDATA[A while back I was working on a javascript based video solution, and I wanted to make it as simple as possible to include a video widget into a page. This would be roughly along the lines of…


   1: &#60;script type=&#34;text/javascript&#34; src=&#34;blah.js&#34;&#62;&#60;/script&#62;    
   2:&#160; 
   3: [...]]]></description>
			<content:encoded><![CDATA[<p>A while back I was working on a javascript based video solution, and I wanted to make it as simple as possible to include a video widget into a page. This would be roughly along the lines of…</p>
<div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
<div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   1:</span> &lt;script type=<span style="color: #006080">&quot;text/javascript&quot;</span> src=<span style="color: #006080">&quot;blah.js&quot;</span>&gt;&lt;/script&gt;    </pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   2:</span>&#160; </pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   3:</span> &lt;script type=<span style="color: #006080">&quot;text/javascript&quot;</span>&gt;</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   4:</span>     </pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   5:</span>     mycompany.video.addVideoWidget({</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   6:</span>         siteId: <span style="color: #006080">&quot;Heat&quot;</span>,</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   7:</span>         keywords: <span style="color: #006080">&quot;Britney Spears&quot;</span>,</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   8:</span>         parent: <span style="color: #006080">&quot;Id of the container&quot;</span></pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   9:</span>     });</pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  10:</span>     </pre>
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  11:</span> &lt;/script&gt;</pre>
</div>
</div>
<p>When authoring a script like this, it needs to be entirely self-contained as you have no knowledge of what other scripts have been included on the host page, or what versions etc.</p>
<p>The issue is how to offer this script when you have a dependency. In this case I wanted to use swfoject as a reliable way to add a flash movie to a page. Another common scenario would be writing script on top of jquery. An example is <a href="http://www.typekit.com">Typekit</a> who end up packaging up and distributing jquery as part of the code they require you to download – <a href="http://www.gsfn.us/typekit/topics/include_only_typekit_js_library_and_not_typekit_jquery">discussed here</a>.</p>
<p>Given that you have no working knowledge of the host page, the only possible option is to package up the dependency, avoid naming conflicts, and include it with your script logic. However this seems quite wasteful given that the host page may also include the same library.</p>
<p>We are so used to using libraries now to make javascript a pleasurable activity, the idea of writing <em>raw</em> script, while possible, is really not an enjoyable prospect.</p>
<p>I don’t have a good answer to the problem – I ended up going down the same route that Typekit have gone. The only other option is to provide a flavour which requires the host page to implement the dependency, but then you lose the simplicity and are open to tricky issues around versioning.</p>
<p>Still, I guess life is short and bandwidth is cheap.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tentonnebaby.com/2009/12/16/problems-having-a-simple-self-contained-script-with-dependencies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Problems with javascript minification that affects SwfObject 2.1 in Internet Explorer</title>
		<link>http://www.tentonnebaby.com/2009/03/26/problems-with-javascript-minification-that-affects-swfobject-21-in-internet-explorer/</link>
		<comments>http://www.tentonnebaby.com/2009/03/26/problems-with-javascript-minification-that-affects-swfobject-21-in-internet-explorer/#comments</comments>
		<pubDate>Thu, 26 Mar 2009 12:01:20 +0000</pubDate>
		<dc:creator>Oli</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://www.embeddedstream.com/2009/03/26/problems-with-javascript-minification-that-affects-swfobject-21-in-internet-explorer/</guid>
		<description><![CDATA[This is actually a more general issue with javascript minification that can affect a number of scripts, but I noticed it while tracking down weird behaviour with the minified version of SwfObject that only affected Internet Explorer.
Basically, standard behaviour with most javascript minifiers is to strip out anything contained within comments. I finally tracked down [...]]]></description>
			<content:encoded><![CDATA[<p>This is actually a more general issue with javascript minification that can affect a number of scripts, but I noticed it while tracking down weird behaviour with the minified version of <a href="http://code.google.com/p/swfobject/">SwfObject</a> that only affected Internet Explorer.</p>
<p>Basically, standard behaviour with most javascript minifiers is to strip out anything contained within comments. I finally tracked down this piece of code in the swfobject library that was getting stripped out (incorrectly) by the minifier…</p>
<div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &#39;Courier New&#39;, courier, monospace; background-color: #f4f4f4">
<div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none">
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #008000">/*@cc_on</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #008000">ie = true;</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #008000">@if (@_win32)</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #008000">windows = true;</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #008000">@elif (@_mac)</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #008000">        mac = true;</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #008000">    @end</span></pre>
<pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #008000">@*/</span></pre>
</p></div>
</div>
<p>This library carries out browser detection by using the proprietary Conditional Compilation feature in Internet Explorer. In order to stop other browsers from choking, the code is wrapped in a comment.</p>
<p>I’m not commenting whether this is a good or bad idea, simply that it does appear in existing scripts, and causes a bunch of javascript minifiers to strip out functional code.</p>
<p>I think my approach will be to revise the set of regular expressions that control what gets stripped out to cater for this variation.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tentonnebaby.com/2009/03/26/problems-with-javascript-minification-that-affects-swfobject-21-in-internet-explorer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Webtrends tracking from Flash</title>
		<link>http://www.tentonnebaby.com/2009/02/27/webtrends-tracking-from-flash/</link>
		<comments>http://www.tentonnebaby.com/2009/02/27/webtrends-tracking-from-flash/#comments</comments>
		<pubDate>Fri, 27 Feb 2009 12:07:19 +0000</pubDate>
		<dc:creator>Oli</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[analytics]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[webtrends]]></category>

		<guid isPermaLink="false">http://www.embeddedstream.com/2009/02/27/webtrends-tracking-from-flash/</guid>
		<description><![CDATA[I&#8217;ve been working on a Flash widget, and the majority of the sites it will be hosted on use WebTrends for analytics. I recently had to look into capturing certain interaction events from the Flash movie and passing them through to WebTrends for reporting.
Flash events are tracked as fake page impressions in WebTrends based on [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on a Flash widget, and the majority of the sites it will be hosted on use WebTrends for analytics. I recently had to look into capturing certain interaction events from the Flash movie and passing them through to WebTrends for reporting.</p>
<p>Flash events are tracked as fake page impressions in WebTrends based on unique URLs that you define. The flash movie doesn&#8217;t talk to WebTrends directly &#8211; it calls through to javascript on the host page which logs the event via standard WebTrends javascript.</p>
<p>In my case I&#8217;m working on a widget that could be hosted on a variety of pages that may or may not implement WebTrends. The required behaviour is for tracking to automatically kick in if the host page implements WebTrends, but gracefully degrade if not. I have a javascript file that handles interaction with the flash movie, so I can guarantee certain js functions exist on the host page.</p>
<p>The solution looks like so&#8230;</p>
<h3>Add an ActionScript class to pass events through to host page</h3>
<div style="border: 1px solid gray; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<div style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">package {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    import flash.external.ExternalInterface;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> Analytics {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">const</span> WIDGET_LOADED:String = <span style="color: #006080;">"/Video/Widget/WidgetLoaded"</span>;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">const</span> PLAYER_LAUNCHED:String = <span style="color: #006080;">"/Video/Widget/PlayerLaunched"</span>;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">function</span> Analytics(): <span style="color: #0000ff;">void</span> {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">function</span> captureEvent(eventType:String) {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            <span style="color: #0000ff;">if</span> (ExternalInterface.available) {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                ExternalInterface.call(<span style="color: #006080;">"mycompany.video.captureAnalyticsEvent"</span>,  eventType);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">}</pre>
</div>
</div>
<p>An example of passing an event to this class&#8230;</p>
<div style="border: 1px solid gray; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; height: 44px; background-color: #f4f4f4;">
<div style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">Analytics.captureEvent(Analytics.WIDGET_LOADED);</pre>
</div>
</div>
<h3>Implement javascript functions on the host page</h3>
<div style="border: 1px solid gray; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<div style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #008000;">/* set up namespace for new functions */</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #0000ff;">if</span> (window[<span style="color: #006080;">"mycompany"</span>] == <span style="color: #0000ff;">null</span>) {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    window[<span style="color: #006080;">"mycompany"</span>] = {};</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">}</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">mycompany.video = {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    webtrendsTrackingFunction: {},</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    captureAnalyticsEvent: <span style="color: #0000ff;">function</span>(eventType) {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        <span style="color: #0000ff;">var</span> uriParam = <span style="color: #006080;">'DCS.dcsuri'</span>;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        <span style="color: #0000ff;">if</span> (<span style="color: #0000ff;">typeof</span> (<span style="color: #0000ff;">this</span>.webtrendsTrackingFunction) == <span style="color: #006080;">'function'</span>) {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            <span style="color: #008000;">// if user has nominated a specific tracking function</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            <span style="color: #0000ff;">this</span>.webtrendsTrackingFunction(uriParam, eventType);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        } <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span> (window[<span style="color: #006080;">"dcsMultiTrack"</span>] != <span style="color: #0000ff;">null</span>) {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            <span style="color: #008000;">// if dcsMultiTrack already implemented on page</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            window.dcsMultiTrack(uriParam, eventType);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        } <span style="color: #0000ff;">else</span> <span style="color: #0000ff;">if</span> (window[<span style="color: #006080;">"dcsTag"</span>] != <span style="color: #0000ff;">null</span>) {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            <span style="color: #008000;">// otherwise if webtrends implemented on page, use default implementation</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            mycompany.video.analytics.dcsMultiTrack(uriParam, eventType);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">}</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">mycompany.video.analytics = {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    dcsMultiTrack: <span style="color: #0000ff;">function</span>() {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        <span style="color: #0000ff;">for</span> (<span style="color: #0000ff;">var</span> i = 0; i &lt; arguments.length; i++) {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            <span style="color: #0000ff;">if</span> (arguments[i].indexOf(<span style="color: #006080;">'WT.'</span>) == 0) {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                WT[arguments[i].substring(3)] = arguments[i + 1]; i++;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            <span style="color: #0000ff;">if</span> (arguments[i].indexOf(<span style="color: #006080;">'DCS.'</span>) == 0) {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">                DCS[arguments[i].substring(4)] = arguments[i + 1]; i++;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            <span style="color: #0000ff;">if</span> (arguments[i].indexOf(<span style="color: #006080;">'DCSext.'</span>) == 0) {</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">                DCSext[arguments[i].substring(7)] = arguments[i + 1]; i++;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">            }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        <span style="color: #0000ff;">var</span> dCurrent = <span style="color: #0000ff;">new</span> Date();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">        DCS.dcsdat = dCurrent.getTime();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        dcsTag();</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    }</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">}</pre>
</div>
</div>
<p>The key points above the script above&#8230;</p>
<ul>
<li>To report events from Flash, WebTrends require an additional function on the host page that they provide &#8211; dcsMultiTrack</li>
<li>If the host page has implemented dcsMultiTrack already, the existing function will be used</li>
<li>If the host page implements standard WT js but <strong>not</strong> the additional function, a fresh implementation of the dcsMultiTrack function will be used</li>
<li>If WebTrends javascript has not been implemented on the host page, nothing bad happens</li>
</ul>
<p>In addition, we have a standard function that the flash movie will always call, so if we need to extend functionality to cater for different analytics systems etc, then we have a single place to implement this.</p>
<p>This is probably the least sexy post I&#8217;ve ever written, but it seemed worthwhile to document this. I&#8217;ll follow up with some sexified content sometime soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tentonnebaby.com/2009/02/27/webtrends-tracking-from-flash/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using ExternalInterface to call Javascript from Actionscript &#8211; &#8216;null&#8217; is null or not an object in IE</title>
		<link>http://www.tentonnebaby.com/2009/02/26/using-externalinterface-to-call-javascript-from-actionscript-null-is-null-or-not-an-object-in-ie/</link>
		<comments>http://www.tentonnebaby.com/2009/02/26/using-externalinterface-to-call-javascript-from-actionscript-null-is-null-or-not-an-object-in-ie/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 11:00:22 +0000</pubDate>
		<dc:creator>Oli</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.embeddedstream.com/2009/02/26/using-externalinterface-to-call-javascript-from-actionscript-null-is-null-or-not-an-object-in-ie/</guid>
		<description><![CDATA[If you are using ExternalInterface in Actionscript 3 to call through to a javascript function, the original object tag that instantiated the flash runtime needs to have an explicit id attribute. Otherwise you&#8217;ll get the above error when running the movie in Internet Explorer.
]]></description>
			<content:encoded><![CDATA[<p>If you are using ExternalInterface in Actionscript 3 to call through to a javascript function, the original object tag that instantiated the flash runtime needs to have an explicit id attribute. Otherwise you&#8217;ll get the above error when running the movie in Internet Explorer.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tentonnebaby.com/2009/02/26/using-externalinterface-to-call-javascript-from-actionscript-null-is-null-or-not-an-object-in-ie/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Added object tag to page via DOM methods &#8211; IE chaos</title>
		<link>http://www.tentonnebaby.com/2009/02/26/added-object-tag-to-page-via-dom-methods-ie-chaos/</link>
		<comments>http://www.tentonnebaby.com/2009/02/26/added-object-tag-to-page-via-dom-methods-ie-chaos/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 10:51:46 +0000</pubDate>
		<dc:creator>Oli</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[dom]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[x-browser]]></category>

		<guid isPermaLink="false">http://www.embeddedstream.com/2009/02/26/added-object-tag-to-page-via-dom-methods-ie-chaos/</guid>
		<description><![CDATA[I&#8217;ve been working on a widget project that involves Flash and Javascript, and came across some very strange behaviour in IE6 / 7. The object tag to render the flash movie is dynamically added to the page at runtime using standard DOM methods &#8211; document.createElement, setAttribute, appendChild etc. Life was wonderful until I opened Internet [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on a widget project that involves Flash and Javascript, and came across some very strange behaviour in IE6 / 7. The object tag to render the flash movie is dynamically added to the page at runtime using standard DOM methods &#8211; document.createElement, setAttribute, appendChild etc. Life was wonderful until I opened Internet Explorer, which hangs with what looks like a request for a file with no timeout (progress bar moving very slowly but never completing). This is identical behaviour to how IE behaves when the location of the SWF is invalid.</p>
<h3>The markup</h3>
<p>The markup I was generating was based on <a href="http://www.alistapart.com/articles/flashsatay">Flash Satay</a>. Including this as static markup in a page works fine. Simple example below&#8230;</p>
<div style="border: 1px solid gray; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<div style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #0000ff;">&lt;</span><span style="color: #800000;">object</span> <span style="color: #ff0000;">type</span><span style="color: #0000ff;">='application/x-shockwave-flash'</span> <span style="color: #ff0000;">data</span><span style="color: #0000ff;">='test.swf'</span> <span style="color: #ff0000;">width</span><span style="color: #0000ff;">='420'</span> <span style="color: #ff0000;">height</span><span style="color: #0000ff;">='155'</span><span style="color: #0000ff;">&gt;</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    <span style="color: #0000ff;">&lt;</span><span style="color: #800000;">param</span> <span style="color: #ff0000;">name</span><span style="color: #0000ff;">='movie'</span> <span style="color: #ff0000;">value</span><span style="color: #0000ff;">='test.swf'</span> <span style="color: #0000ff;">/&gt;</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #0000ff;">&lt;/</span><span style="color: #800000;">object</span><span style="color: #0000ff;">&gt;</span></pre>
</div>
</div>
<h3>DOM approach that chokes IE</h3>
<p>The following approach causes IE to choke&#8230;</p>
<div style="border: 1px solid gray; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<div style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">&lt;script type=<span style="color: #006080;">"text/javascript"</span>&gt;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    <span style="color: #0000ff;">var</span> <span style="color: #0000ff;">object</span> = document.createElement(<span style="color: #006080;">'object'</span>);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    <span style="color: #0000ff;">object</span>.setAttribute(<span style="color: #006080;">'type'</span>, <span style="color: #006080;">'application/x-shockwave-flash'</span>);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    <span style="color: #0000ff;">object</span>.setAttribute(<span style="color: #006080;">'data'</span>, <span style="color: #006080;">'test.swf'</span>);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    <span style="color: #0000ff;">object</span>.setAttribute(<span style="color: #006080;">'width'</span>, <span style="color: #006080;">'100'</span>);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    <span style="color: #0000ff;">object</span>.setAttribute(<span style="color: #006080;">'height'</span>, <span style="color: #006080;">'100'</span>);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    <span style="color: #0000ff;">var</span> param = document.createElement(<span style="color: #006080;">'param'</span>);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    param.setAttribute(<span style="color: #006080;">'name'</span>, <span style="color: #006080;">'movie'</span>);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    param.setAttribute(<span style="color: #006080;">'value'</span>, <span style="color: #006080;">'test.swf'</span>);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    <span style="color: #0000ff;">object</span>.appendChild(param);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    document.body.appendChild(<span style="color: #0000ff;">object</span>);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">&lt;/script&gt;</pre>
</div>
</div>
<h3>The solution / workaround</h3>
<p>For some reason if the object tag + params are parsed at the same time everything works fine, so the solution involves using the alternate approach to manipulating the DOM &#8211; innerHTML. This wouldn&#8217;t have been my first choice given the situation, but it seems to be the only way to get this working. A version that works in IE&#8230;</p>
<div style="border: 1px solid gray; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<div style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">&lt;script type=<span style="color: #006080;">"text/javascript"</span>&gt;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    <span style="color: #0000ff;">var</span> fragment =</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        <span style="color: #006080;">"&lt;object type='application/x-shockwave-flash' data='test.swf' width='100' height='100'&gt;"</span> +</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">            <span style="color: #006080;">"&lt;param name='movie' value='test.swf' /&gt;"</span> +</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">        <span style="color: #006080;">"&lt;/object&gt;"</span>;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    <span style="color: #0000ff;">var</span> container = document.createElement(<span style="color: #006080;">'div'</span>);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;">    container.innerHTML = fragment;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">    document.body.appendChild(container);</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">&lt;/script&gt;</pre>
</div>
</div>
<p>This achieves the same end result &#8211; a DOM element node that can be inserted anyway you wish, but avoid the problem in IE.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tentonnebaby.com/2009/02/26/added-object-tag-to-page-via-dom-methods-ie-chaos/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Simulated Events and Firefox</title>
		<link>http://www.tentonnebaby.com/2007/06/19/simulated-events-and-firefox/</link>
		<comments>http://www.tentonnebaby.com/2007/06/19/simulated-events-and-firefox/#comments</comments>
		<pubDate>Tue, 19 Jun 2007 18:17:07 +0000</pubDate>
		<dc:creator>Oli</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[events]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.embeddedstream.com/2007/06/19/simulated-events-and-firefox/</guid>
		<description><![CDATA[Suppose you want to write some javascript to simulate an event taking place. For many of the common events, there is the equivalent method, so you can call click() on an element to simulate a mouse click. After a painful debugging session today I found that doing this in Firefox means that the wrong element [...]]]></description>
			<content:encoded><![CDATA[<p>Suppose you want to write some javascript to simulate an event taking place. For many of the common events, there is the equivalent method, so you can call <em>click()</em> on an element to simulate a mouse click. After a painful debugging session today I found that doing this in Firefox means that the wrong element ends up on the <em>event.target</em> property, which can cause various problems when you&#8217;re handling the event.</p>
<p>In this case I had an input element that was kicking off an ansychronous form submit when clicked. On top of this I&#8217;m implementing drag and drop behaviour, so I figured it would be as simple as simulating the click event when the item was dragged and dropped in the right way. The click handler already worked, and kicked off the async operation as desired, so it should be a nice layer on top.</p>
<p>The async operation basically hijacks the form submit if it is caused by certain elements, and performs an async post instead. The problem with the event target in Firefox meant that this behaviour never kicked in.</p>
<p>A workaround was to use <a href="http://developer.mozilla.org/en/docs/DOM:element.dispatchEvent">dispatchEvent</a> instead. This allows a simulated click which results in the correct event target set. This is in the W3C DOM level 2 spec, and is implemented in Firefox (but not IE).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tentonnebaby.com/2007/06/19/simulated-events-and-firefox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript New Releases</title>
		<link>http://www.tentonnebaby.com/2006/10/23/javascript-new-releases/</link>
		<comments>http://www.tentonnebaby.com/2006/10/23/javascript-new-releases/#comments</comments>
		<pubDate>Mon, 23 Oct 2006 09:37:05 +0000</pubDate>
		<dc:creator>Oli</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[dom]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[reading]]></category>
		<category><![CDATA[reviews]]></category>

		<guid isPermaLink="false">http://www.embeddedstream.com/2006/10/23/javascript-new-releases/</guid>
		<description><![CDATA[There are a couple of new books that are worth taking a look at. The first is the O&#8217;Reilly book on Atlas. I&#8217;m currently reading this one from APress, but I&#8217;ve heard rumour that the OReilly book provides much more context in examining the underlying technologies that Atlas is based on.
The other is one that [...]]]></description>
			<content:encoded><![CDATA[<p>There are a couple of new books that are worth taking a look at. The first is the <a href="http://www.oreilly.com/catalog/atlas/">O&#8217;Reilly book</a> on Atlas. I&#8217;m currently reading <a href="http://www.apress.com/book/bookDisplay.html?bID=10104">this one</a> from APress, but I&#8217;ve heard rumour that the OReilly book provides much more context in examining the underlying technologies that Atlas is based on.</p>
<p>The other is one that I&#8217;ve been looking forward to for a little while now, <a href="http://www.quirksmode.org/book/">PPK on Javascript</a>. This comes from the guy behind quirksmode.org and should be an interesting read. It&#8217;s along a similar direction as <a href="http://domscripting.com/book/">DOM Scripting</a> but providing the next level of detail, where DOM Scripting was a great introduction into modern use of javascript and the <acronym title="Document Object Model">DOM</acronym>. My copy should be delivered midweek, so I&#8217;ll let you know how I get on with it.</p>
<p>If javascript makes you feel sad or confused and you need a little light relief, you should come along to <a href="http://www.officiallondontheatre.co.uk/shows/display?contentId=91216">Stephen K Amos</a> at the Garrick theatre on Thursday (I have no idea about ticket availability &#8211; currently assuming we can get some for thurs). I&#8217;ve been to a couple of shows in Edinburgh which made my face hurt from laughter. I&#8217;m eager for more face-ache, so should be going this week too.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tentonnebaby.com/2006/10/23/javascript-new-releases/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Atlas or YUI?</title>
		<link>http://www.tentonnebaby.com/2006/07/03/atlas-or-yui/</link>
		<comments>http://www.tentonnebaby.com/2006/07/03/atlas-or-yui/#comments</comments>
		<pubDate>Mon, 03 Jul 2006 12:16:55 +0000</pubDate>
		<dc:creator>Oli</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[libraries]]></category>
		<category><![CDATA[YUI]]></category>

		<guid isPermaLink="false">http://www.embeddedstream.com/2006/07/03/atlas-or-yui/</guid>
		<description><![CDATA[For a little while I've been meaning to take a proper look at Atlas, Microsoft's main offering to help out in building AJAX applications and richer web based interfaces...]]></description>
			<content:encoded><![CDATA[<p>For a little while I&#8217;ve been meaning to take a proper look at <a href="http://atlas.asp.net">Atlas</a>, Microsoft&#8217;s main offering to help out in building <acronym title="Asynchronous Javascript and XML">AJAX</acronym> applications and richer web based interfaces.</p>
<p>Javascript is definately back in fashion, with a number of libraries popping up to help out with application development. I think overall this is fine, so long as you have an appreciation of what is actually happening under the scenes. I don&#8217;t think a library should dictate the way that you build an application, rather enable you to build it more efficiently.</p>
<p>I&#8217;ve started using elements of the <a href="http://developer.yahoo.com/yui/">Yahoo YUI library</a> which is very impressive. There seem to be a lot of very useful little utility functions available, the kind of thing that you would typically rewrite on each project.</p>
<p>I&#8217;m quite curious about how the Microsoft and Yahoo libraries compare. I&#8217;ll post some information about this when I&#8217;ve had a chance to look in more detail at Atlas.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tentonnebaby.com/2006/07/03/atlas-or-yui/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PPK on Javascript</title>
		<link>http://www.tentonnebaby.com/2006/06/28/ppk-on-javascript/</link>
		<comments>http://www.tentonnebaby.com/2006/06/28/ppk-on-javascript/#comments</comments>
		<pubDate>Wed, 28 Jun 2006 11:34:33 +0000</pubDate>
		<dc:creator>Oli</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[reviews]]></category>

		<guid isPermaLink="false">http://www.embeddedstream.com/2006/06/28/ppk-on-javascript/</guid>
		<description><![CDATA[Peter-Paul Koch is publishing a new book on Javascript. If you have been following the work of Jeremy Keith, chances are you&#8217;ve come across his book which is one of the best modern web development books I&#8217;ve read. This looks like it extends the same ideas, but goes into much more technical detail.
It&#8217;s not out [...]]]></description>
			<content:encoded><![CDATA[<p>Peter-Paul Koch is publishing a <a href="http://www.quirksmode.org/blog/archives/2006/06/more_about_the.html">new book</a> on Javascript. If you have been following the work of <a href="http://www.adactio.com">Jeremy Keith</a>, chances are you&#8217;ve come across <a href="http://domscripting.com/book">his book</a> which is one of the best modern web development books I&#8217;ve read. This looks like it extends the same ideas, but goes into much more technical detail.</p>
<p>It&#8217;s not out just yet, but worth keeping an eye out for &#8211; I think the UK release is towards the end of August.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tentonnebaby.com/2006/06/28/ppk-on-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
