我有一个如下格式的url:
http://www.example.com/manchester united
注意曼彻斯特和曼联之间的空隙,这是糟糕的做法,还是完全好,我只是想在继续之前,谢谢
我有一个如下格式的url:
http://www.example.com/manchester united
注意曼彻斯特和曼联之间的空隙,这是糟糕的做法,还是完全好,我只是想在继续之前,谢谢
在URI中,空格不是有效字符;您必须将其替换为%20
。这也可能被视为不良做法。最好将空格替换为-
、+
或_
;它既“漂亮”又不需要转义URI。
大多数浏览器仍然会尝试使用空格来解析URI;但这是非常模糊的。
It s bad practice not only because browsers are required to turn the space into a %20 and thus obfuscate your users address bars, but because it would be difficult to communicate the url to anyone. Furthermore, what about all of those "find links in text" regexes that are around stack overflow? You effectively break them all!
它将在地址栏中被替换为http://www.example.com/manchester%20united,我个人认为这比其他选择要丑陋得多http://www.example.com/manchester_united。
我相信URLS中的空格被许多浏览器用%20符号取代了。
你需要添加%20而不是空格,但浏览器会为你添加,我宁愿在URI中没有空格
从技术上讲,这是可行的。浏览器将用%20
替换空格,服务器将其翻译回。
但是这通常不是一个好主意,因为它可能会导致歧义,或难以与他人交流URL,尤其是在广告环境中,你希望有人输入他们在印刷品中看到的URL。
也许是一个问题:https://webmasters.stackexchange.com/
但是
如果你在浏览器中输入than,它将在曼彻斯特和曼联之间添加%20。从技术上讲,你应该在HTML页面中这样做,但大多数现代浏览器都可以处理。通常的做法是用连字符将它们分开,即http://www.example.com/manchester-united。
请查看此问题的URL,以获取实际操作中的示例。
可以这样做,但显然这是一种糟糕的风格。
请参阅以下内容:http://www.blooberry.com/indexdot/html/topics/urlencoding.htm
I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....
I have a div <div id="masterdiv"> which has several child <div>s. Example: <div id="masterdiv"> <div id="childdiv1" /> <div id="childdiv2" /> <div id="...
I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...
<form><input type="file" name="first" onchange="jsFunction(2);"> <input type="file" name="second" onchange="jsFunction(3);"</form> Possible to pass just numbers to the js ...
So I ve got a menu with a hover/selected state and it loads fine in IE6/IE7. However when I scroll down the page and put the element outside of the viewport and then back in I get a broken image! I ...
I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...
Is it possible to reload a form after file-input change? I have a form where the user can chose an image for upload. I also have a php script which displays that image resized. I only wonder if it ...
I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!