title: google chrome iframe body onLoad not working?
body: <p><strong>EDIT: It does work (sorry).</strong> Something in this script is causing it to stop in google chrome:</p>
  
  <pre><code>function checkLocation() {
    var loc = top.location.href;
    var suffix = "subpage.html";
    if (loc.indexOf(suffix, loc.length - suffix.length) !== -1) {
        top.location.href = "index.html";
    }
  }
  </code></pre>
  
  <p><strong>Original post:</strong></p>
  
  <p>I have IE 9, FF 3.6.3, Chrome (18.0.1025.151) and Safari 5.1.5 all installed.</p>
  
  <p>This works in all of the browsers except google chrome.</p>
  
  <p>I have a HTML layout which contains a named iframe. The iframe src changes to display the different pages. On one of the pages I have a script which is loaded onLoad in the body tag. This script doesn't load when the page is loaded in the iframe in google chrome only - it works fine in other browsers. Also, if I load the page directly into google chrome (not via an iframe) it works just fine.</p>
  
  <p>How do I fix this?</p>
  
  <p>Here is an example code:</p>
  
  <pre><code>index.html
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
  &lt;html&gt; &lt;head&gt; &lt;title&gt; Example Page &lt;/title&gt; &lt;/head&gt;
         &lt;body&gt; &lt;a href="subpage.html" target="targetFrame"&gt;View subpage&lt;/a&gt;&lt;BR/&gt;
                &lt;iframe name="targetFrame"&gt; &lt;/iframe&gt;
         &lt;/body&gt;
  &lt;/html&gt;
  
  subpage.html
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
  &lt;html&gt; &lt;head&gt; &lt;title&gt; Subpage &lt;/title&gt;
                &lt;script type="text/javascript" src="subpage.js"&gt; &lt;/script&gt;
         &lt;/head&gt;
         &lt;body onLoad="initialise()"&gt; Hello &lt;/body&gt;
  &lt;/html&gt;
  
  subpage.js
  function initialise() {
      alert("Script loaded.");
  }
  </code></pre>
  
  <p>Thanks for looking.</p>