+ Start a Discussion
Ranu JainRanu Jain 

salesforce login from html page

i have to login into salesforce  org by an html page outside the salesforce....please giv some suggestion what to do for it ...n  i have to include below file

<script src="/soap/ajax/11.0/connection.js"></script>
<script src="/soap/ajax/11.0/apex.js"></script>

 should i have to download it ...? from where


Hi Ranu,


If you want to connect to salesforce.com from a standalone application , one way would be consuming salesforce.com partner/enterprise wsdl ,call the login method with your username as your salesforce.com username and password as your salesforce.com instance password+security token.


If you simply want to login to salesforce.com from a html page try to use something like this

<a href="https://login.salesforce.com/?un=username&pw=password">Login to My developer account</a>

 username - salesforce.com username, password - salesforce.com password.

if you are trying to login to a sandbox then please use something like this 


<a href="https://test.salesforce.com/?un=username&pw=password">Login to My Sandbox account</a>




Hope this helps,


(please don't forget to mark this post as the solution if it is the solution)


You have to include the absolute URL of the file, or browser security will probably stop you from running the login script. Then again, your browser might prohibit you anyways, and you'd need to use a JSONP or AJAX proxy. Be wary of using leaving an open proxy on your server, though...

Ranu JainRanu Jain

Thnaks for reply.........my atual need is not login...but i have to fetch some data from the org like  all account  ........and display taht data in html page ....for which i was thinking that i have to write code to connect to salesforce and login ....does is possible by ur first rply ...or any other approach?


Actually Above code is looging in the account ,

But How to show Errors like password is not correct or username not valid etc which is generated by salsforce  in my custom page. 

Hi Ranu,

         As I doing the same task that, how to login throught html page and getting details from salesforce i heard that to use API. But i can't getting the salesforce API. and i done this task but... instead of getting the details i going that details at time with login.

If this solves your problem, kindly mark it as the best answer.