title: getting an error Object doesn't support property or method 'setSrc' in web Resource in CRM 2011
body: <p>I have used the WebResource on the Page and I am getting an error Object doesn't support property or method 'setSrc' in Javascript</p>
  
  <p>Can you Please help me</p>
  
  <p>My actual code is like this </p>
  
  <pre><code>function getImage()
  {
  var entityId = Xrm.Page.data.entity.getId();
  var profilePictureElement = Xrm.Page.getControl("WebResource_ProfilePicture");
  if (entityId) {
      var oDataQuery = getServerUrl() + "/XRMServices/2011/OrganizationData.svc" +
          "/AnnotationSet?$top=1&amp;$select=AnnotationId,DocumentBody,MimeType&amp;" +
          "$orderby=ModifiedOn desc&amp;$filter=ObjectId/Id eq guid'" + entityId +
          "' and IsDocument eq true and Subject eq 'Profile Picture'" +
          " and startswith(MimeType,'image/') ";
  
      $.ajax({
          type: "GET",
          contentType: "application/json; charset=utf-8",
          datatype: "json",
          url: oDataQuery,
          beforeSend: function (request) { request.setRequestHeader("Accept", "application/json"); },
          success: function (data, textStatus, request) {
              if (data.d.results.length &gt; 0) {
                  var mimeType = data.d.results[0].MimeType;
                  var body = data.d.results[0].DocumentBody;
                  // set src attribute of default profile picture web resource.
                  // here we use DataURI schema which has 32kb limit in IE8 and doesn't support IE &lt;= 7.
                  profilePictureElement.setSrc("data:" + mimeType + ";base64," + body);
  
              }
          },
          error: function (request, status, exception) { }
      });
    }
  }
  function getServerUrl()
  {
  var serverUrl = Xrm.Page.context.getServerUrl();
  // trim trailing forward slash in url
  return serverUrl.replace(/\/*$/, "");
  }
  </code></pre>
  
  <p>you can refer the whole article from here <a href="http://blogs.msdn.com/b/crm/archive/2011/09/28/displaying-a-contact-s-facebook-picture-in-microsoft-dynamics-crm-2011.aspx?CommentPosted=true#commentmessage" rel="nofollow">http://blogs.msdn.com/b/crm/archive/2011/09/28/displaying-a-contact-s-facebook-picture-in-microsoft-dynamics-crm-2011.aspx?CommentPosted=true#commentmessage</a></p>