How to go up one sub-domain in a relative URL?

白昼怎懂夜的黑 提交于 2019-12-31 04:22:07

问题


From a page at cupcakes.dessert.mysite.com/, how can I use a relative URL to access images or a style-sheet from dessert.mysite.com/? Is there a way to specify "back one sub-domain" in URIs?

I don't want to use an absolute URL such as src="http://dessert.mysite.com/images/bg.gif" because that approach would require a different absolute URL for salad.mysite.com, as well as possibly overriding an HTTPS connection.


回答1:


That is not possible.

To address your second concern, use a protocol-relative URL:

src="//dessert.mysite.com/images/bg.gif"


来源:https://stackoverflow.com/questions/13299452/how-to-go-up-one-sub-domain-in-a-relative-url

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!