title: "SecurityError: The operation is insecure" when try to set img src to base64 value
body: <p>I have a array which store some base64 values like the one below:</p>
  
  <pre><code>"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD ..."
  </code></pre>
  
  <p>I made this function:</p>
  
  <pre><code>var base64Matcher = new RegExp("^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$");
  $.each(inputValues, function(key, value) {
      if (base64Matcher.test(value)) {
          $('#' + key).attr('src', value);
      } else {
          $('#' + key).val(value);
      }
  });
  </code></pre>
  
  <p>Based on <a href="https://stackoverflow.com/questions/7126846/detect-base64-encoding">this post</a> but when I try to load values I get this error:</p>
  
  <blockquote>
    <p>SecurityError: The operation is insecure</p>
  </blockquote>
  
  <p>How did you test if value is base64 encode and then set the <code>src</code> attribute right? Here is a image showing what holds <code>inputValues</code> is just values I just found trough those values and if it's <code>base64</code> encode then I set <code>src</code> because that is a image, the function fails only when I load a image</p>
  
  <p><img src="https://i.stack.imgur.com/sKHUI.png" alt="enter image description here"></p>
  
  <p>PS: I checked <a href="https://stackoverflow.com/questions/2183347/how-to-set-the-image-src-using-jquery">this</a> and <a href="https://stackoverflow.com/questions/8594998/setting-img-src-to-base64-encoded-image-with-javascript-is-failing">this</a> post without success, any?</p>