链接到域根的最佳方法是什么? [英] What is the best way to link to domain root?
问题描述
我正在设置链接,不确定哪个链接到域根目录的最佳方法
I'm setting up links and not sure which is the best way to link to the domain root should I do
< a href =/>主页< / a>
或< a href =http://example.com>主页< / a>
?
还有一种我不知道的冷静方式吗?
is there a cooler way that I'm unaware of?
推荐答案
除非您有特殊原因要始终使用HTTP,否则请使用< a href = / >文字< / A>
。否则你会遇到SSL的问题。
Unless you have a specific reason you want to always use HTTP, use <a href="/">text</a>
. You'll run into problems with SSL otherwise.
如果你正在加载脚本,那么有一种更酷的方法可以做到这一点,那就是加载跨域脚本协议中立的方式,如下:
There is a cooler way to do it if you're loading scripts, and that is to load cross domain scripts in a protocol-neutral way, as such:
<script src="//example-cdn.com/scripts/jquery-latest-min.js"></script>
这样就可以避免IE中的HTTP混合内容警告。
That way you avoid the HTTP mixed content warnings in IE.
这篇关于链接到域根的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!