I noticed odd behavior whenever I used the IP address in the URL in my CRM 2011 environment. If I used the server name (or on my VM, localhost) everything worked as expected. However, when using the IP Address/organization, custom ribbon icons are broken.
Broken Ribbon Icons and Jscript code when using IP Address/Organization with CRM 2011
Also, Jscript code for inheriting values from related records is broken. In this case I was using a JSON query against the OrganizationData.svc.
I tracked it down to this little discrepancy. The standard call for the server url from the CRM SDK is as follows:
var _context = Xrm.Page.context;
var _rootSite = _context.getServerUrl();
But here is the code snippet I recommend instead. This will work when call CRM with the IP Address, localhost or the server name.
var _rootSite = document.location.protocol + “//” + document.location.host + “/” + Xrm.Page.context.getOrgUniqueName();