Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How should the meta refresh URL resolve? #7332

Open
danny0838 opened this issue Nov 13, 2021 · 4 comments
Open

How should the meta refresh URL resolve? #7332

danny0838 opened this issue Nov 13, 2021 · 4 comments
Labels
interop Implementations are not interoperable with each other needs tests Moving the issue forward requires someone to write tests

Comments

@danny0838
Copy link

When a web page https://example.com/page has the following content, what should the meta refresh target be for each case?

case 1

<base target="subdir/">
<meta http-equiv="refresh" content="0; url=target.html">

In Firefox 94, it's https://example.com/target.html.

In Chromium 95, it's https://example.com/subdir/target.html.

case 2

<meta http-equiv="refresh" content="0; url=target.html">
<base target="subdir/">

In Firefox 94, it's https://example.com/target.html.

In Chromium 95, it's https://example.com/target.html.

case 3

<meta http-equiv="refresh" content="1; url=target.html">
<base target="subdir/">

In Firefox 94, it's https://example.com/target.html.

In Chromium 95, it's https://example.com/subdir/target.html.


It seems that Firefox resolves a meta refresh using the initial base URL.

Chromium resolves a meta refresh using the current base URL. However, if the time of a meta refresh is 0, Chromium resolves the meta refresh at the time the tag is loaded, and, as a result, all following <base>s are not taken into account.

What is the expected behavior by the web standard? I have read https://html.spec.whatwg.org/#attr-meta-http-equiv-refresh, but failed to understand what should happen in such cases.

@annevk annevk added the interop Implementations are not interoperable with each other label Nov 15, 2021
@annevk
Copy link
Member

annevk commented Nov 15, 2021

So the "shared declarative refresh steps" algorithm runs when the meta element is inserted. In step 11.11 of that algorithm it parses the URL relative to the document (that ends up using the current base URL). Later that URL is used to navigate, potentially after a delay.

That would mean that Chrome is correct for case 1 and Firefox for case 3.

Would you be willing to create web-platform-tests for these scenarios?

@danny0838
Copy link
Author

What do you mean "create web-platform-tests"?

@annevk
Copy link
Member

annevk commented Nov 18, 2021

See https://github.com/web-platform-tests/wpt. It's a project that hosts cross-browser tests to foster interoperability between browsers.

@danny0838
Copy link
Author

Sorry. Not familiar with that. Maybe some long long long future day...

@annevk annevk added the needs tests Moving the issue forward requires someone to write tests label Nov 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interop Implementations are not interoperable with each other needs tests Moving the issue forward requires someone to write tests
Development

No branches or pull requests

2 participants