0

I have writen this below sample JavaScript program to open a website in a new window .

My Question is , is it possible that once we have the Username and password , can we make him automatically login into gmail site once he clicks on Open Window button ??

Please share your views

<html>
<head>
<script>
function open_win()
{
window.open("http://www.gmail.com")
}
</script>
</head>
<body>

<input type="button" value="Open Window" onclick="open_win()">

</body>
</html>
2
  • 2
    So you want user to give you his login+password from gmail account? Well, that.. sounds.. legit? Nov 6, 2012 at 7:36
  • Yes , the reason i want to test my website the same way
    – Pawan
    Nov 6, 2012 at 7:38

2 Answers 2

0

No, there's no way you can do this, because gmail authorization action is a HttpPost-action, and you won't be able to do such cross-server request. Or you work in google and you have access to Access-Control-Allow-Origin header.

0

No, you cannot.

Even if you could, I thing google will not appreciate this and currently are working on how to not allow these kind of things.

So even if you will manage to make it work it will stop working after some time, because you probably will use some kind of security hole.

EDIT:

If you want to use this for your own website and in the same domain, then yes, you can do it using normal sessions or code some fancy not safe login.

Probably you want to use oauth or some other authorization approach.

EDIT:

Open popup, ask for credentials. On post send request to server, login, edit session. And after that on client side use js windows to close current popup and refresh main page. Main page will check session data and you know that user in logged in.

1
  • I dont want do it on google , but on my website , i have name="custid" name="password" on my website logon.jsp page ,and a submit button how can i do login ??
    – Pawan
    Nov 6, 2012 at 7:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.