为什么 Chrome 在验证之前调用自动完成的 url? [英] Why is Chrome calling the autocompleted url before validation?

查看:16
本文介绍了为什么 Chrome 在验证之前调用自动完成的 url?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的网站上使用 API 向用户发送电子邮件,在测试我的通话时,我注意到我收到了两次电子邮件.

I'm using an API on my website to send emails to the users and while testing my call I noticed I was receiving the email twice.

所以 url 看起来像 "localhost/api/sendEmail" 并且,至少在 Chrome 上,当我在 localhost 上并开始输入 "/ap"url 自动完成.

So the url looks like "localhost/api/sendEmail" and, at least on Chrome, when I'm on localhost and I start typing "/ap" the url is automatically completed.

我可以在 Fiddler 上看到 Chrome(我认为是他)实际上在我按下 Enter 之前调用了它,因此邮件被发送,当我按下 Enter 时,它当然会再次发送.

And I can see on Fiddler that Chrome (well I think that's him) is actually calling it before I press Enter so the mail is sent, and when I press Enter it is of course sent a second time.

这不是问题,因为它不会被最终用户直接调用,但我只是想知道第一次调用的目的是什么?Chrome 是否会预先调用页面以加快加载速度?它会在不同的情况下引起问题吗?可以防止 Chrome 出现这种行为吗?

This is not a problem since it won't be directly callable by the end-user, but I was just wondering what is the purpose of this first call ? Is Chrome pre-calling the page to make it faster to load ? Can it cause problems in different situations? Can one prevent Chrome from behaving like this?

再说一次,这根本不是问题,但我只是想知道.

Again, not a problem at all, but I'm just wondering.

推荐答案

这是 Google 的 prefetch 功能,假设您执行自动完成的 URL,它可以更快地加载页面.

This is Google's prefetch feature, which loads the page quicker, assuming you execute the auto-completed URL.

您可以在 Google Chrome 中禁用此选项:

You can disable this option in Google Chrome:

Settings > Advanced Settings > Privacy: (uncheck) Prefetch resources..

这篇关于为什么 Chrome 在验证之前调用自动完成的 url?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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