<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Going Global</title>
	<atom:link href="http://nerd.metrocat.org/2006/07/going-global/feed" rel="self" type="application/rss+xml" />
	<link>http://nerd.metrocat.org/2006/07/going-global</link>
	<description>You're reading Jeff Watkins' thoughts about Web application design and development with a little bit of technology ranting thrown in for free.</description>
	<lastBuildDate>Sun, 08 Jun 2008 07:06:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: siralucard_1</title>
		<link>http://nerd.metrocat.org/2006/07/going-global/comment-page-1#comment-1815</link>
		<dc:creator>siralucard_1</dc:creator>
		<pubDate>Sat, 21 Apr 2007 07:00:56 +0000</pubDate>
		<guid isPermaLink="false">http://nerd.newburyportion.com/2006/07/going-global#comment-1815</guid>
		<description>&lt;p&gt;sorry, im kinda new here so, i didnt know how to write html code.. thats why the &quot;&quot;+ajax.responseText is wrong written, it should display:
...&lt;/p&gt;

&lt;p&gt;&quot;&lt;br style=&#039;line-height:0px !important;&#039; /&gt;&quot;+ajax.responseText&lt;/p&gt;

&lt;p&gt;...&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>sorry, im kinda new here so, i didnt know how to write html code.. thats why the &#8220;&#8221;+ajax.responseText is wrong written, it should display:
&#8230;</p>

<p>&#8220;&lt;br style=&#8217;line-height:0px !important;&#8217; /&gt;&#8221;+ajax.responseText</p>

<p>&#8230;</p>]]></content:encoded>
	</item>
	<item>
		<title>By: siralucard_1</title>
		<link>http://nerd.metrocat.org/2006/07/going-global/comment-page-1#comment-1814</link>
		<dc:creator>siralucard_1</dc:creator>
		<pubDate>Sat, 21 Apr 2007 06:50:00 +0000</pubDate>
		<guid isPermaLink="false">http://nerd.newburyportion.com/2006/07/going-global#comment-1814</guid>
		<description>&lt;p&gt;Im not in the mood to write a long explanation, so those who where experiencing the problem that IE didnt exec the extrernal &#039;ajaxed&#039; javascripts, well, I found something interesting (It is something with the innerHTML).
If you add something like this to the innerHTML=responseText line will fix the problem (im not an expert so i really dont know why a newline added to the innerHTML fixes it):
&lt;code&gt;
...&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;container.innerHTML = &quot;&quot;+ajax.responseText&lt;/p&gt;

&lt;p&gt;...
&lt;/p&gt;

&lt;p&gt;Hope this helps anybody, it worked for me... after l
LONG LONG hours(DAMN IE).&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Im not in the mood to write a long explanation, so those who where experiencing the problem that IE didnt exec the extrernal &#8216;ajaxed&#8217; javascripts, well, I found something interesting (It is something with the innerHTML).
If you add something like this to the innerHTML=responseText line will fix the problem (im not an expert so i really dont know why a newline added to the innerHTML fixes it):
<code>
...</code></p>

<p>container.innerHTML = &#8220;&#8221;+ajax.responseText</p>

<p>&#8230;
</p>

<p>Hope this helps anybody, it worked for me&#8230; after l
LONG LONG hours(DAMN IE).</p>]]></content:encoded>
	</item>
	<item>
		<title>By: uomo</title>
		<link>http://nerd.metrocat.org/2006/07/going-global/comment-page-1#comment-1487</link>
		<dc:creator>uomo</dc:creator>
		<pubDate>Mon, 26 Feb 2007 07:55:22 +0000</pubDate>
		<guid isPermaLink="false">http://nerd.newburyportion.com/2006/07/going-global#comment-1487</guid>
		<description>&lt;p&gt;The information I found here was rather helpful. Thank you for this.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>The information I found here was rather helpful. Thank you for this.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: XoraX</title>
		<link>http://nerd.metrocat.org/2006/07/going-global/comment-page-1#comment-1447</link>
		<dc:creator>XoraX</dc:creator>
		<pubDate>Tue, 20 Feb 2007 19:42:27 +0000</pubDate>
		<guid isPermaLink="false">http://nerd.newburyportion.com/2006/07/going-global#comment-1447</guid>
		<description>&lt;p&gt;all code is not really compatible with Safari.
all variable declared in global is not accessible directly after (in the function who call the eval global).&lt;/p&gt;

&lt;p&gt;exec this with safari :&lt;/p&gt;

&lt;p&gt;global eval&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/p&gt;

&lt;pre&gt;
var screentest = function (s, w){
  var t = &#039;bug&#039;;

  if(w){
    var Start = (new Date()).getTime();
    while(typeof test != &#039;function&#039;) {
      if( ((new Date()).getTime() - Start) &gt; 6000 ){
        addconsole(&#039;infinite while: test() is &#039;+typeof(test) +&#039; after &#039;+ ((new Date()).getTime() - Start) +&#039;ms on &#039;+s);
        break;
      }
    }
  }
  try{
    t = test(s);
    addconsole(t);
    return true;
  } catch (e) {
    addconsole(&#039;error: &#039;+e+ &#039; -- on -- &#039;+s);
    return false;
  }
}

var addconsole = function (s){
  document.getElementById(&#039;console&#039;).innerHTML += &#039;&#039; +s;
}

function globaleval (){
  var s = &quot;var test = function (s){ return &#039;test() running in global scope: &#039;+s;};&quot;;
  if(window.execScript){
    window.execScript(s);
    if(screentest(&#039;window execScript&#039;))
      return;
  }
  if(window.eval) {
    window.eval(s);
    if(!screentest(&#039;window eval&#039;)){
      window.setTimeout(s,0);
      if(!screentest(&#039;setTimeout eval&#039;,true)){
        addconsole(&#039;last try with setTimeout(screentest)...&#039;);
        setTimeout(&#039;screentest(&quot;setTimeout eval and called with setTimeout&quot;);&#039;,0);
      }
    }
  }
}

&lt;/pre&gt;

&lt;p&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;

&lt;b&gt;-- console --&lt;/b&gt;

&lt;/p&gt;

&lt;p&gt;or view online at http://www.xorax.info/test/eval.php&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>all code is not really compatible with Safari.
all variable declared in global is not accessible directly after (in the function who call the eval global).</p>

<p>exec this with safari :</p>

<p>global eval</p>

<p><code></code></p>

<pre>
var screentest = function (s, w){
  var t = 'bug';

  if(w){
    var Start = (new Date()).getTime();
    while(typeof test != 'function') {
      if( ((new Date()).getTime() - Start) &gt; 6000 ){
        addconsole('infinite while: test() is '+typeof(test) +' after '+ ((new Date()).getTime() - Start) +'ms on '+s);
        break;
      }
    }
  }
  try{
    t = test(s);
    addconsole(t);
    return true;
  } catch (e) {
    addconsole('error: '+e+ ' -- on -- '+s);
    return false;
  }
}

var addconsole = function (s){
  document.getElementById('console').innerHTML += '' +s;
}

function globaleval (){
  var s = "var test = function (s){ return 'test() running in global scope: '+s;};";
  if(window.execScript){
    window.execScript(s);
    if(screentest('window execScript'))
      return;
  }
  if(window.eval) {
    window.eval(s);
    if(!screentest('window eval')){
      window.setTimeout(s,0);
      if(!screentest('setTimeout eval',true)){
        addconsole('last try with setTimeout(screentest)...');
        setTimeout('screentest("setTimeout eval and called with setTimeout");',0);
      }
    }
  }
}

</pre>

<p></p>

<p>

<b>&#8211; console &#8211;</b>

</p>

<p>or view online at <a href="http://www.xorax.info/test/eval.php" rel="nofollow">http://www.xorax.info/test/eval.php</a></p>]]></content:encoded>
	</item>
	<item>
		<title>By: Matthew Williams</title>
		<link>http://nerd.metrocat.org/2006/07/going-global/comment-page-1#comment-1293</link>
		<dc:creator>Matthew Williams</dc:creator>
		<pubDate>Thu, 01 Feb 2007 13:45:28 +0000</pubDate>
		<guid isPermaLink="false">http://nerd.newburyportion.com/2006/07/going-global#comment-1293</guid>
		<description>&lt;p&gt;This is exactly what I need, however, I cannot determine where it needs to be executed.  I have a page with a varity of DIVs that get populated via AJAX.Updater calls using Prototype.&lt;/p&gt;

&lt;p&gt;I populate one DIV with another DIV and when I try to populate that with a Dojo widget; it doesn&#039;t render and I just get plain text.  Between this and the recent article on Ajaxian, I know the solution is right under my nose, I just can&#039;t get it implemented.&lt;/p&gt;

&lt;p&gt;A bit new to JavaScript but frameworks such as Prototype, Moo Tools, OpenRico and Dojo make it so easy to make a really slick site.&lt;/p&gt;

&lt;p&gt;If you&#039;d like to offer a helping hand, please contact me directly:
matthew.d.williams [at] gmail.com&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>This is exactly what I need, however, I cannot determine where it needs to be executed.  I have a page with a varity of DIVs that get populated via AJAX.Updater calls using Prototype.</p>

<p>I populate one DIV with another DIV and when I try to populate that with a Dojo widget; it doesn&#8217;t render and I just get plain text.  Between this and the recent article on Ajaxian, I know the solution is right under my nose, I just can&#8217;t get it implemented.</p>

<p>A bit new to JavaScript but frameworks such as Prototype, Moo Tools, OpenRico and Dojo make it so easy to make a really slick site.</p>

<p>If you&#8217;d like to offer a helping hand, please contact me directly:
matthew.d.williams [at] gmail.com</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Joseph Smarr &#187; Fixing eval() to use global scope in IE</title>
		<link>http://nerd.metrocat.org/2006/07/going-global/comment-page-1#comment-1289</link>
		<dc:creator>Joseph Smarr &#187; Fixing eval() to use global scope in IE</dc:creator>
		<pubDate>Wed, 31 Jan 2007 17:23:45 +0000</pubDate>
		<guid isPermaLink="false">http://nerd.newburyportion.com/2006/07/going-global#comment-1289</guid>
		<description>&lt;p&gt;[...] (PS: Having found the magic term execScript, I was then able to find some related articles on this topic by Dean Edwards and Jeff Watkins. However much of the details are buried in the comments, so I hope this article will increase both the findability and conciseness of this information). [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[...] (PS: Having found the magic term execScript, I was then able to find some related articles on this topic by Dean Edwards and Jeff Watkins. However much of the details are buried in the comments, so I hope this article will increase both the findability and conciseness of this information). [...]</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Kiran</title>
		<link>http://nerd.metrocat.org/2006/07/going-global/comment-page-1#comment-1238</link>
		<dc:creator>Kiran</dc:creator>
		<pubDate>Sat, 20 Jan 2007 10:17:06 +0000</pubDate>
		<guid isPermaLink="false">http://nerd.newburyportion.com/2006/07/going-global#comment-1238</guid>
		<description>&lt;p&gt;
Sorry, but I posted that wrong.
Heres the script. Lolz.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;pre&gt;
function iS( script ) {
    if (!script) return;
    if (window.execScript) window.execScript(script);
    else if (navigator.userAgent.indexOf(&#039;Safari&#039;)!=-1) window.setTimeout(script,0);
    else window.eval(script);
}
function evalGS() {iS(&quot;bar = function(){return &#039;bar&#039;;}&quot;);}
function tF() {eval(&#039;alert(bar)&#039;);}
evalGS();
tF();&lt;/pre&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Just a &#039;small&#039; mistake. :P&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>
Sorry, but I posted that wrong.
Heres the script. Lolz.</p>

<p><code><pre>
function iS( script ) {
    if (!script) return;
    if (window.execScript) window.execScript(script);
    else if (navigator.userAgent.indexOf('Safari')!=-1) window.setTimeout(script,0);
    else window.eval(script);
}
function evalGS() {iS("bar = function(){return 'bar';}");}
function tF() {eval('alert(bar)');}
evalGS();
tF();</pre></code></p>

<p>Just a &#8217;small&#8217; mistake. :P</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Kiran</title>
		<link>http://nerd.metrocat.org/2006/07/going-global/comment-page-1#comment-1237</link>
		<dc:creator>Kiran</dc:creator>
		<pubDate>Sat, 20 Jan 2007 05:04:44 +0000</pubDate>
		<guid isPermaLink="false">http://nerd.newburyportion.com/2006/07/going-global#comment-1237</guid>
		<description>&lt;p&gt;Hi Jeff,
First of all, I&#039;d like to thank you for this discussion. I was really going crazy about how to make objects or functions defined through eval defined in global scope. I was trying to improve the security of the scripts on my site, some playing with Javascript when I was getting bored with my usual collage life, lolz. Unfortunately, the answer I found in this discussion did not work out fine for me!!
I used the following script, just a matter of testing.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;pre&gt;
function iS( script ) {
    if (!script) return;
    if (window.execScript) window.execScript(script);
        else window.setTimeout(script,0);
}
function evalGS() {iS(&quot;function bar(){return &#039;bar&#039;;}&quot;);}
function tF() {eval(&#039;bar();&#039;);}
evalGS();
tF();&lt;/pre&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Which, unfortunately, did not work out fine for me on my Firefox (v2.0.0.1). Well, tried working with 
... eval(&quot;bar=function(){return &#039;bar&#039;;}&quot; ...
No luck with that either.&lt;/p&gt;

&lt;p&gt;And I don&#039;t give up just like you... :P... So I just worked out a little. Tried out some other alternatives.Started with window._content.eval(), tried to check out the compatibility of this statement with other browsers. However, I found out later that to execute eval in Global Scope, we can just use window.eval() in Opera and this works out pretty fine on Firefox too.
So, my script now goes like this...&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;pre&gt;
function iS( script ) {
    if (!script) return;
    if (window.execScript) window.execScript(script);
        else if (navigator.userAgent.indexOf(&#039;Safari&#039;)==-1) window.setTimeout(data,0);
            else window.eval(script);
}
function evalGS() {iS(&quot;bar = function(){return &#039;bar&#039;;}&quot;);}
function tF() {eval(&#039;alert(bar)&#039;);}
evalGS();
tF();&lt;/pre&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This worked fine for me on IE, FF, Opera.
Please verify it for yourself :).
I havent tested it on Safari, However, I would be glad if you could test it for me.&lt;/p&gt;

&lt;p&gt;Anyway thanks again for this discussion. It was great :).&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hi Jeff,
First of all, I&#8217;d like to thank you for this discussion. I was really going crazy about how to make objects or functions defined through eval defined in global scope. I was trying to improve the security of the scripts on my site, some playing with Javascript when I was getting bored with my usual collage life, lolz. Unfortunately, the answer I found in this discussion did not work out fine for me!!
I used the following script, just a matter of testing.</p>

<p><code><pre>
function iS( script ) {
    if (!script) return;
    if (window.execScript) window.execScript(script);
        else window.setTimeout(script,0);
}
function evalGS() {iS("function bar(){return 'bar';}");}
function tF() {eval('bar();');}
evalGS();
tF();</pre></code></p>

<p>Which, unfortunately, did not work out fine for me on my Firefox (v2.0.0.1). Well, tried working with 
&#8230; eval(&#8221;bar=function(){return &#8216;bar&#8217;;}&#8221; &#8230;
No luck with that either.</p>

<p>And I don&#8217;t give up just like you&#8230; :P&#8230; So I just worked out a little. Tried out some other alternatives.Started with window._content.eval(), tried to check out the compatibility of this statement with other browsers. However, I found out later that to execute eval in Global Scope, we can just use window.eval() in Opera and this works out pretty fine on Firefox too.
So, my script now goes like this&#8230;</p>

<p><code><pre>
function iS( script ) {
    if (!script) return;
    if (window.execScript) window.execScript(script);
        else if (navigator.userAgent.indexOf('Safari')==-1) window.setTimeout(data,0);
            else window.eval(script);
}
function evalGS() {iS("bar = function(){return 'bar';}");}
function tF() {eval('alert(bar)');}
evalGS();
tF();</pre></code></p>

<p>This worked fine for me on IE, FF, Opera.
Please verify it for yourself :).
I havent tested it on Safari, However, I would be glad if you could test it for me.</p>

<p>Anyway thanks again for this discussion. It was great :).</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Gauthier Delamarre</title>
		<link>http://nerd.metrocat.org/2006/07/going-global/comment-page-1#comment-961</link>
		<dc:creator>Gauthier Delamarre</dc:creator>
		<pubDate>Mon, 04 Dec 2006 11:05:03 +0000</pubDate>
		<guid isPermaLink="false">http://nerd.newburyportion.com/2006/07/going-global#comment-961</guid>
		<description>&lt;p&gt;Alf, was just about to say same thing about IE7 ; mine throws exceptions when using scriptTag.innerHTML, and runs fine with scriptTag.text&lt;/p&gt;

&lt;p&gt;However, it stills a problem : getElementsByTagName doesn&#039;t return ALL script objects... only one of five is returned (in IE7 always, FF 2 reports 5 scripts, and everything&#039;s ok)&lt;/p&gt;

&lt;p&gt;PS : Alf, i&#039;m precisely working on some of your scripts, i&#039;ll send you the result of my work if you want :)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Alf, was just about to say same thing about IE7 ; mine throws exceptions when using scriptTag.innerHTML, and runs fine with scriptTag.text</p>

<p>However, it stills a problem : getElementsByTagName doesn&#8217;t return ALL script objects&#8230; only one of five is returned (in IE7 always, FF 2 reports 5 scripts, and everything&#8217;s ok)</p>

<p>PS : Alf, i&#8217;m precisely working on some of your scripts, i&#8217;ll send you the result of my work if you want :)</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Alf Magne Kalleland</title>
		<link>http://nerd.metrocat.org/2006/07/going-global/comment-page-1#comment-953</link>
		<dc:creator>Alf Magne Kalleland</dc:creator>
		<pubDate>Sun, 03 Dec 2006 16:46:30 +0000</pubDate>
		<guid isPermaLink="false">http://nerd.newburyportion.com/2006/07/going-global#comment-953</guid>
		<description>&lt;p&gt;Thank you very much for the execScript idea Jeff. That saved my day:-)&lt;/p&gt;

&lt;p&gt;Just a quick note on the Opera browser.&lt;/p&gt;

&lt;p&gt;Opera doesn&#039;t support innerHTML for the script tag. Instead you have to use the &quot;text&quot; attribute.&lt;/p&gt;

&lt;p&gt;scriptTag.text &lt;/p&gt;

&lt;p&gt;instead of&lt;/p&gt;

&lt;p&gt;scriptTag.innerHTML&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Thank you very much for the execScript idea Jeff. That saved my day:-)</p>

<p>Just a quick note on the Opera browser.</p>

<p>Opera doesn&#8217;t support innerHTML for the script tag. Instead you have to use the &#8220;text&#8221; attribute.</p>

<p>scriptTag.text </p>

<p>instead of</p>

<p>scriptTag.innerHTML</p>]]></content:encoded>
	</item>
</channel>
</rss>
