通过Javascript自动Yahoo!邮件或Gmail登录 [英] Automatic Yahoo!mail or Gmail login by Javascript

查看:82
本文介绍了通过Javascript自动Yahoo!邮件或Gmail登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我想写一个HTML页面,它可以帮助我直接登录我的

Yahoo!邮件或Gmail帐户输入用户名和密码。

基本上,我想设置一个链接,点击它并弹出Yahoo / Gmail

页面。


什么技术最适合这种工作?


我目前的解决方案并不那么令人满意:我下载Yahoo!Mail页面

并将其保存到本地文件;然后使用Javascript加载该文件和

设置用户名,密码,将其提交给雅虎。


这适用于雅虎,但不适用于Gmail。我没有时间调查

为什么。


我讨厌这个解决方案的是:对于每个电子邮件提供商,我

需要下载他们的页面并写相应的页面

访问/修改它。


还有更好的解决方案吗?


您的建议非常感谢!


Stan

解决方案

文章< 11 ********************** @ l41g2000cwc.googlegroups .com> ;, marmot101

@ gmail.com enlightened我们用...

我想写一个HTML页面,它可以帮助我直接登录我的
Yahoo!邮件或Gmail帐户,而无需输入用户名和密码。
基本上,我想设置一个链接,点击它并弹出Yahoo / Gmail
页面。

哪种技术最适合这类工作?


POP3。 ;)

这适用于雅虎,但不适用于Gmail。我没有时间调查
为什么。


谷歌检查推荐人。

设置它(谷歌),你很高兴。大概。我没有Gmail,但是

这对我的某个应用程序的谷歌搜索来说是一个问题。

但是,就解决方案而言,不是很便携。

我讨厌这个解决方案的是:对于每个电子邮件提供商,我都需要下载他们的页面并写相应的页面来访问/修改它。

有没有更好的解决方案?




不是我能看到的。他们可能会有不同的字段名称而不是
,他们将有不同的推荐人(如果他们检查),所以任何代码

都必须使用不同的无论如何,POST请求的名称和值。并且

有些人可能会验证您必须复制的其他标题。当我尝试使用MySpace.com时,这是一个

问题。


您可以使用Java(或任何支持发送HTTP的语言)

POST请求),但它可能比它的价值更令人痛苦。


-

-

~kaeli~

亵渎性:所有程序员都使用的单一语言

expert。
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace


"斯坦利"问


我想写一个HTML页面,它可以帮助我直接登录我的
Yahoo!邮件或Gmail帐户,而无需输入用户名和密码。基本上,我想设置一个链接,点击它并弹出Yahoo / Gmail
页面。

哪种技术最适合这类工作?




我有一个书签,可以自动填写我经常访问的页面上的某些表格

够了。如果你使用IE浏览器,那么就像下面一样,全部在一行,少于508

个字符:


javascript :function (){

var a = document.forms [0] .elements,i = a.length,j,k;

while(i - ){

j = a [i],k = j.name;

if(location.host ===''mail.yahoo.com''){

if(k ===''login''){j.value =''myname''; }

else if(k ===''passwd''){j.value =''mypassword''; }

}

else if(location.host ===''gmail.google.com''){

if(k = ==''电子邮件''){j.value =''myname''; }

else if(k ===''Passwd''){j.value =''mypassword''; }

}

}

document.forms [0] .submit();

}


考虑谁可以访问收藏夹文件夹并阅读其内容,并且

决定它是否安全。也许耐心和重复打字的持续努力是最合适的。

-

Io


" Ivo" < no@thank.you>写道:

我有一个书签,可以自动填写我经常访问的页面上的某些表格
。如果你使用IE浏览器,那么就像下面一样,全部在一行,少于508个字符:




可爱的主意。为了使它尽可能短,它可以被重写一些

喜欢:

---

javascript :( function(){

var k = {

''mail.yahoo.com'':[0,{login:''myname'',passwd: ''mypass''}],

''gmail.google.com'':[0,{Email:''myname'',passwd:''mypass''}]
} [location.host],

f = document.forms [k [0]],e = f.elements,i = e.length,v;

while(i - )if(v = k [1] [e [i]])e [i] .value = v;

f.submit();

})();

---

请记住在使用前加上一行。如果在错误的页面上使用它会产生Javascript

错误,但是谁在乎:)当

空格和换行符被删除时,它就是~260
数据文字的格式为:

{< hostname> :[< form index>,{< fieldname>:< value> ,...}],

...}

它允许登录表单不是第一个的页面,并且

任何数量的字段都需要填写。


如果密码或用户名真的重复,可以通过首先分配给变量的
来保存空间,并且在数据对象中重用它。


(是的,我认为优化空间是有趣的* :)

/ L

-

Lasse Reichstein Nielsen - lr*@hotpop.com

DHTML死亡颜色:< URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>

''没有判断的信仰只会降低精神神圣。''


Hi,

I''d like to write a HTML page which can help me directly log in my
Yahoo!mail or Gmail account without typing user name and password.
Basically, I want to set up a link, click it and pop up the Yahoo/Gmail
page.

What technology is most appropriate for this kind of work?

My current solution is not so satisfying: I download Yahoo!Mail page
and save it to local file; then using Javascript to load that file and
set up user name, password, submit it to Yahoo.

This works with Yahoo, but not Gmail. I haven''t got time to investigate
why.

The thing I hate about this solution is: for every email provider, I
need to download their page and write corresponding page to
access/modify it.

Is there any better solution?

Your suggestion is highly appreciated!

Stan

解决方案

In article <11**********************@l41g2000cwc.googlegroups .com>, marmot101
@gmail.com enlightened us with...

I''d like to write a HTML page which can help me directly log in my
Yahoo!mail or Gmail account without typing user name and password.
Basically, I want to set up a link, click it and pop up the Yahoo/Gmail
page.

What technology is most appropriate for this kind of work?
POP3. ;)

This works with Yahoo, but not Gmail. I haven''t got time to investigate
why.
Google checks the referrer.
Set it (to google) and you''re good to go. Probably. I don''t have Gmail, but
this was an issue for Google Search for one of my apps.
Not very portable, though, as far as solutions go.

The thing I hate about this solution is: for every email provider, I
need to download their page and write corresponding page to
access/modify it.

Is there any better solution?



Not that I can see. They''re all going to have different field names more than
likely and they will have different referrers (if they check), so any code
would have to use different names and values for the POST request anyway. And
some may verify other headers that you would have to duplicate. This was an
issue when I tried to putz around with MySpace.com.

You could play with Java for this (or any language that supports sending HTTP
POST requests), but it''s probably more of a pain than it''s worth.

--
--
~kaeli~
Profanity: the single language in which all programmers are
expert.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace


"Stanley" asks


I''d like to write a HTML page which can help me directly log in my
Yahoo!mail or Gmail account without typing user name and password.
Basically, I want to set up a link, click it and pop up the Yahoo/Gmail
page.

What technology is most appropriate for this kind of work?



I have a bookmarklet to auto-fill some forms on pages I visit regularly
enough. something like the following, all on one line and in less than 508
characters if you use IE:

javascript:function(){
var a=document.forms[0].elements,i=a.length,j,k;
while(i--){
j=a[i], k=j.name;
if(location.host===''mail.yahoo.com''){
if(k===''login''){ j.value=''myname''; }
else if(k===''passwd''){ j.value=''mypassword''; }
}
else if(location.host===''gmail.google.com''){
if(k===''Email''){ j.value=''myname''; }
else if(k===''Passwd''){ j.value=''mypassword''; }
}
}
document.forms[0].submit();
}

Consider who can access the Favorites folder and read its contents, and
decide if it''s safe with that in mind. Perhaps patience and the continuous
effort of repeated typings is the most appropriate after all.
--
Io



"Ivo" <no@thank.you> writes:

I have a bookmarklet to auto-fill some forms on pages I visit regularly
enough. something like the following, all on one line and in less than 508
characters if you use IE:



Cute idea. To make it as short as possible, it could be rewritten something
like:
---
javascript:(function(){
var k={
''mail.yahoo.com'': [0,{login:''myname'',passwd:''mypass''}],
''gmail.google.com'':[0,{Email:''myname'',passwd:''mypass''}]
}[location.host],
f=document.forms[k[0]],e=f.elements,i=e.length,v;
while(i--)if(v=k[1][e[i]])e[i].value=v;
f.submit();
})();
---
Remember to put on one line before using. It will give a Javascript
error if it is used on an incorrect page, but who cares :) When
spaces and line breaks are removed, it''s ~260 bytes.

The format of the data literal is:
{ <hostname> : [ <form index>, { <fieldname>:<value> , ... } ] ,
... }
It allows for pages where the login form is not the first one, and
any amount of fields that need to be filled.

If passwords or usernames are really repeated, space can be saved by
assigning to a variable first, and reusing it in the data object.

(Yes, I think optimizing for space is *fun* :)
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
''Faith without judgement merely degrades the spirit divine.''


这篇关于通过Javascript自动Yahoo!邮件或Gmail登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆