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
Elad Kaplan 3Elad Kaplan 3 

Login to salesforce using connection.js

Does anybody has a working example that uses the connection.login.js ?

I'm trying to connect to salesforce from an exterior website using javascript and getting an Error.

Here is My code:


<script src="" ></script>

<script type="text/javascript" >

function logincall()

    var usrname = document.getElementById('userid').value;
    var passwrd = document.getElementById('passid').value;

    if(usrname == null || usrname == '' || passwrd == null || passwrd == '')
        alert('Please enter Username AND Password');
    var result = sforce.connection.login(usrname, passwrd);

    alert("Logged in with session id " + result.sessionId);




To test logging into a Salesforce Instance using the connection.js "login" call

            <td><input type="text" id="userid" value="" /></td>
            <td><input type="password" id="passid" value="" /></td>


    <input type="button" value="Login" onclick="logincall();" />



I'm getting an Error :  The requested url services/Soap/u/30.0 was not found on this server

Any idea anyone?

This should help:

I think you are missing this line:

Ravikant kediaRavikant kedia
Hi Elad Kaplan 3,
                              How to solve above problem in javascript code outside salesforce envrionment please give me some idea or code to solve above problem because i am facing same problem in creating chrome extension .
Thanks in Advance.

Ravi NarayananRavi Narayanan
anyone achieved the above task of connecting html to salesforcE?
Koustubh KulkarniKoustubh Kulkarni
Anyone know how to login through HTML page to salesforce community?
John smith 391John smith 391
Anyone know how to login salesforce using javascript not visual force
Honza KoubaHonza Kouba
I would also like to know the possibilities. Thank you