Chrome 浏览器不喜欢没有 http:// 的 *.loc 域名?
对于本地主机上的 Web 开发,我使用域名末尾带有 .loc 扩展名的域。
例如:如果我在roses.com 网站上工作,则本地开发域将为roses.loc (在主机文件和 IIS 中定义为绑定中的主机标头)
我的首选浏览器(我用于开发的主要浏览器是 Chrome)但不幸的是 它无法将扩展名为 .loc 的域名识别为 http://rose.loc - 每次我都会将我带到谷歌搜索页面在开头输入rose.loc(不带http://)。
您是否有过类似的经历?有什么解决办法吗?
因为在密集的开发测试过程中,由于各种原因清除浏览器缓存并重新启动浏览器,每次我忘记输入 http 时,每次我忘记输入 http 时,都会被抛出到 google 搜索页面而不是我希望注意到一些变化的开发页面,这是非常烦人的url 之前的 :// (而且 Chrome 是默认隐藏它的,无论如何..)
For web development on localhost I'm using domains with .loc extension at the end of a domain name.
For example: if I work on a site roses.com, the local development domain would be roses.loc
(defined in hosts file and IIS as a host-header in binding)
My preferred browser (the main browser I use for development is Chrome) but unfortunately
it does not recognize a domain name with .loc extension as http://rose.loc - it throws me onto a google search page each time I would type in rose.loc (without http://) in the beginning..
Have you experienced this in a similar way ? Is there some solution to that ?
Because during intensive development testing with clearing browser cache and restarting the browser for various reasons, it's getting pretty annoying to be thrown at a google search page instead of the development page where I expect to notice some changes, each time I forget to type in http:// before the url (and Chrome is the one who hides it by default, anyway..)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
谷歌浏览器在这方面非常“聪明”。它使用已知良好 TLD 列表,并假设其他所有内容都只是发生的搜索词以点结尾,后跟一些字符。
99% 的情况下都没有问题。 “只有”我们开发人员和少数具有奇怪网络设置的人必须为大多数人的利益而受苦;-)
您可以尝试使用
.local
作为您的 TLD,因为这是一个定义的域引用本地域名(至少在某些 mDNS 系统中使用)。该问题已在 Chromium 错误跟踪器中以 #30636 的形式输入。一种似乎经常(但并非总是)有效的解决方法是将
/
附加到您的主机名。因此,请尝试roses.loc/
。Google Chrome is pretty "smart" with this. It uses a list of known-good TLDs and assumes everything else is just a search term that happens to end in a dot followed with some characters.
99% of the time that's perfectly fine. It's "only" us developers and a few people with strange network setups that have to suffer for the good of the majority ;-)
You can try using
.local
as your TLD, as that's a defined domain for referencing local domain names (at least it's used in some mDNS systems).The issue has been entered as #30636 in the Chromium bug tracker. One workaround that often (but not always) seems to work is to append
/
to your hostname. So tryroses.loc/
.我创建了一个关键字为“l”的搜索引擎(我的本地 TLD 是 .l)。搜索引擎的 URL 为
http://%sl
。然后,我只需在地址栏中输入“l mysite”,它就会转到 mysite.l。I've created a search engine with a keyword of 'l' (my local TLD is .l). The URL for the search engine is
http://%s.l
. Then, I simply type "l mysite" in the address bar and it takes me to mysite.l.以下是我针对此错误提出的解决方法:http:// /code.google.com/p/chromium/issues/detail?id=30636#c38
Here is a workaround I came up with for this bug: http://code.google.com/p/chromium/issues/detail?id=30636#c38
我在 Linux Mint 上安装了 Chromium,并且这里有一些本地主机网站。 (我的所有工作都使用 Firefox,因此我刚刚通过 Chromium 发现了一些东西。)我的本地站点名为
morse
和az
。我必须分别输入http://morse/
和az/
才能首次加载这些网站。他们在新选项卡的空白页面上生成了快速链接。关闭 Chromium 后,我重新打开它,只需输入
morse/
和az
即可访问这些网站。由于我从来没有认真使用过这个浏览器,所以我没有在其中定制任何设置。 (我没有使用快速链接图标,而是在地址栏中输入。)我的发现证实 localhost
example.TLD/
条目在第一次输入时确实有效。关于 Chromium:我正在使用适用于 Linux Mint(64 位)的版本 106.0.5249.119(官方版本)。
I have Chromium installed on Linux Mint, and have a few localhost websites here. (I use Firefox for all of my work, so I have just discovered something here with Chromium.) My local sites are called
morse
anda.z
. I had to enterhttp://morse/
anda.z/
respectively to get these sites to load the first time. They produced quick links on the new tab's otherwise blank page.After closing Chromium, I reopened it and I could enter just
morse/
anda.z
to visit these sites. Since I've never seriously used this browser, I have not tailored any settings in it. (I did not use the quick link icons, but instead typed in the address bar.)My findings confirm the localhost
example.TLD/
entry does work when entered for the first time.About Chromium: I am using Version 106.0.5249.119 (Official Build) for Linux Mint (64-bit).