+ Start a Discussion
JimmyC1228JimmyC1228 

Firefox Login Problems

I am trying to write an s-control which switches the current login to that of a system administrator so that certain data only available to admins can be queried.  I have the following code, which works in IE when I enable cross-domain data access in the security settings, but gives me a permission error in Firefox when it calls XMLhttprequest.open.  It also won't work in IE if that security setting isn't changed.  Does anyone have any suggestions for fixing this without changing the security settings?  I am new to the world of s-controls; so, any help would be greatly appreciated.  Thanks.

    function initSession() {

        sforceClient.setLoginUrl("https://www.salesforce.com/services/Soap/u/7.0");
        sforceClient.init(null, null, false);
        var loginResult = sforceClient.login("abc@xyz.com","1234");
        alert(loginResult);
    }
zachzach
Here's what I use & it seems to work:

Code:
function setUser() {
 if (window.XMLHttpRequest) sforceClient.appType = Sforce.Application.Type.FireFox;
 sforceClient.setLoginUrl("https://www.salesforce.com/services/Soap/u/7.0");
 sforceClient.init("{!API_Session_ID}", "{!API_Partner_Server_URL_70}", false);

 var loginResult = sforceClient.login("username","password");
 //alert(loginResult);

 loadPage();
}

 

JimmyC1228JimmyC1228
Thanks  for your help Zach,
That code lets me login as another user successfully, but as soon as I try to run a query, I get the same permission error.  If I enable cross-domain data access in IE or change the signed.applets.codebase_principle_support value in Firefox to true, then the error works.  So, it has something to do with browser security settings.  Is there another way to get around this problem?  It would be preferable to not have to change the security settings on users' computers.  Thanks.