function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
onthebeachonthebeach 

Firefox permission woes

Getting the dreaded permission exception on XmlHttpRequest.open error when I attempt to login().  Everything is hosted on sfdc, so not sure why I'm getting this.  Here are some germane snippets:

<script language="javascript" src="https://www.salesforce.com/services/lib/ajax/beta3.3/sforceclient.js" type="text/javascript"></script>       

sforceClient.setLoginUrl("https://www.salesforce.com/services/Soap/u/7.0");
    var loginResult = sforceClient.login("xxx@xxxx.com", "xxx");
    if (loginResult.className != "LoginResult") {
        alert("Login failed! Here's the error: " + loginResult);
    }



thanks

Message Edited by onthebeach on 07-26-2006 09:26 AM

jlojlo
Since you are trying to access a secure endpoint, you should verify that you are not trying to execute this s-control from a non-secure page. e.g. http:// instead of https://


onthebeachonthebeach
thanks for the suggestion.  I already checked this, since technically a host is considered different if it's accessed via different protocols, in this case http vs. https.


SuperfellSuperfell
I believe you're getting sanboxed by the browser because you're trying to connect to www.salesforce.com from nax.salesforce.com.
onthebeachonthebeach
Simon,

I agree that is the problem.  Does it make sense to do this:

sforceClient.setLoginUrl("https://naX.salesforce.com/services/Soap/u/7.0");

Salesforce usually urges using www. for logging in.
SuperfellSuperfell
If you're logging into as a user in the same organization, then its safe to use the {!API_Partner_70_Url} (or whatever it is) merge field.
onthebeachonthebeach
ok, I'm now using:

sforceClient.setLoginUrl("{!API_Partner_Server_URL_70}");

But I'm getting the same error: uncaught exception: Permission denied to call method XMLHttpRequest.open

when using setLoginUrl(), is it necessary to call init()?  Not sure what else could be causing this problem.. 
zachzach
This seems to work for me...

Code:
 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);

 

onthebeachonthebeach
The difference in my case is that we're not using init(), since we're not assuming there is an existing session.  We're using login() instead.
zachzach
I use the login() after that code as well...

Code:
 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);