Javascript XMLHttpRequest 登录提示

发布于 2024-09-08 09:57:10 字数 568 浏览 4 评论 0原文

我是 JavaScript 新手,编写了一个简单的扩展来解析 gmail Atom feed 并显示未读电子邮件的数量。

我的问题是,如果由于某种原因你没有登录你的谷歌帐户,扩展程序会尝试检查提要,Safari 会显示一个像这样的登录框。

替代文本 http://img576.imageshack.us/img576/743/loginhd.png< /a>

由于我每 10 秒检查一次,这些提示会堆积起来并劫持浏览器,导致您无法登录。另外通过此提示登录似乎什么也没做。

是否有办法忽略读取提要的失败尝试?我的请求如下所示:

xmlHttp = new XMLHttpRequest();
xmlHttp.open('GET', url, true);
xmlHttp.onreadystatechange = checkForNewMessagesCallBack;
xmlHttp.send(null);

I am new to javascript and wrote a simple extension to parse the gmail atom feed and display the number of unread emails.

My problem is if for some reason you're not logged into your google account, the extension attempts to check the feed and Safari will display a login box like this.

alt text http://img576.imageshack.us/img576/743/loginhd.png

And since I check every 10 seconds these prompts stack up and hijack the browser to the point where you can't go login. Also loggin via this prompt seems to do nothing.

Is there anyway to ignore failed attempts to read the feed? My request looks like this:

xmlHttp = new XMLHttpRequest();
xmlHttp.open('GET', url, true);
xmlHttp.onreadystatechange = checkForNewMessagesCallBack;
xmlHttp.send(null);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

多孤肩上扛 2024-09-15 09:57:10

我不认为这是一次失败的尝试,因此您可以忽略它.. 更像是正在进行中,并且系统会要求您提供信息以便它可以完成..

如果这是供个人使用,您可以使用 https://用户名:密码@URL
这种方法的安全风险当然是显而易见的..

I do not see it as a failed attempt so you can ignore it .. more like in progress and you are asked for info so that it can complete..

If this is for personal use you could use the https://username:password@URL
The security risks of that method are of course obvious ..

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文