does http-equiv Refresh meta tag URL get a leading slash?

1.4k views Asked by At

This follows in meta tag, url with slash vs url without slash. All the answers missed something in the original poster's example: it's about meta http-equiv Refresh, about which HTML5 specifies that the path is to be relative to where the file with the Refresh value is located. Usually, paths are relative to the base element, and, to save coding, we may have a trailing slash in the base element's URL, so that a relative URL based on the base element will not have a leading slash. But http-equiv Refresh is a different case and I don't know the answer. For example, I don't know if it's determined by a browser or the server, for example. Does anyone here know? Thank you.

2

There are 2 answers

0
karlcow On

Step 23.

Resolve the url value to an absolute URL, relative to the meta element. If this fails, abort these steps.

absolute URL is defined in the URL spec.

An absolute URL must be a scheme, followed by ":", followed by either a scheme-relative URL, if scheme is a relative scheme, or scheme data otherwise, optionally followed by "?" and a query.

You may also want to read that section of HTML5 about URLS

The document base URL of a Document object is the absolute URL obtained by running these substeps:

  1. If there is no base element that has an href attribute in the Document, then the document base URL is the Document's fallback base URL; abort these steps.
  2. Otherwise, the document base URL is the frozen base URL of the first base element in the Document that has an href attribute, in tree order.
0
Sheikh Uzair Hussain On

If the URL is given without a slash, the path will be relative to the document and if the URL is given with the slash, the path will be relative to the root. It's determined by the browser and all the browsers, in this case, will do the same thing.