title: Opera and Safari do not fire image.onload
body: <pre><code>function controllaFoto(target, username) {
      var _URL = window.URL || window.webkitURL;
      var img = new Image();
      img.onload = function () {
          if(this.width &gt; 240 || this.height &gt; 240) {
              document.getElementById("photoLabel").innerHTML = "Text";
              document.getElementById("preview").setAttribute("src", "profile?to=showImage&amp;username="+username);
              target.value = "";
          } else {
              document.getElementById("photoLabel").innerHTML = "";
              document.getElementById("preview").setAttribute("src", this.src);
          }
      };
      img.src = _URL.createObjectURL(target.files[0]);
      return true;
  }
  </code></pre>
  
  <p>This script is called by the <code>onchange</code> and <code>onsubmit</code> attributes and works fine in Firefox and Chrome, but not in Opera and Safari. The event <code>onload</code> is not triggered. Why?</p>
  
  <p><strong>UPDATE</strong> I'm testing it with Windows.</p>
  
  <p><strong>UPDATE 2</strong> The problem is that <code>_URL</code> is <code>undefined</code>. I tried with </p>
  
  <pre><code>var _URL = window.URL || window.webkitURL || window.mozURL || window.msURL || window.oURL;
  </code></pre>
  
  <p>but still not working.</p>
  
  <p>For Chrome its value is <code>object DOMURL</code>, for Firefox is <code>object MozURLProperty</code>, but for Safari and Opera is <code>undefined</code>. So the console says:</p>
  
  <blockquote>
    <p>Uncaught exception: TypeError: Cannot convert '_URL' to object</p>
  </blockquote>