有没有HTTP标题来说明用于相对链接的基本URL? [英] Is there an HTTP header to say what base URL to use for relative links?

查看:79
本文介绍了有没有HTTP标题来说明用于相对链接的基本URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从另一个主机中检索一个页面,然后在将数据发送给用户之前使用数据库中的数据初始化表单。

I am retrieving a page from another host, and then initializing the form with data from a database before sending it on to the user.

我需要 href src 中的网址属性为绝对值,以便浏览器从正确的位置加载它们。

I need to make the URLs in href and src attributes absolute, so that the browsers load them from the right place.

我可以在不修改HTML的情况下设置一个HTTP标头吗?

Can I set an HTTP header to cause this to happen without modifying the HTML?

推荐答案

没有这样的HTTP。但是您可以使用 HTML的 BASE 元素,例如:

There is no such for HTTP. But you can set the base URL with HTML’s BASE element like:

<base href="http://example.com/">

这篇关于有没有HTTP标题来说明用于相对链接的基本URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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