content icon indicating copy to clipboard operation
content copied to clipboard

example.com is a better choice for an example domain

Open RyoRyo-2010 opened this issue 7 months ago • 9 comments

MDN URL

https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Strict-Transport-Security

What specific section or headline is this issue about?

Description

What information was incorrect, unhelpful, or incomplete?

foo.com is a real domain, so I think it's better to use example.com when writing examples.

(Sorry, but it is a machine translation)

What did you expect to see?

example.com is better.

Do you have any supporting links, references, or citations?

https://en.wikipedia.org/wiki/Example.com

Do you have anything more you want to share?

No response

MDN metadata

Page report details
  • Folder: en-us/web/http/reference/headers/strict-transport-security
  • MDN URL: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Strict-Transport-Security
  • GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/web/http/reference/headers/strict-transport-security/index.md
  • Last commit: https://github.com/mdn/content/commit/ee756fd51ccbc4820a4b334aa753648650ad1d51
  • Document last modified: 2025-05-23T16:30:28.000Z

RyoRyo-2010 avatar Jun 09 '25 07:06 RyoRyo-2010

We could do a global search & replace for all foo.com & bar.com examples. There seem to be quite a few

Josh-Cena avatar Jun 09 '25 16:06 Josh-Cena

It's a bit unfortunate here, because http://example.com does not redirect to https://example.com :(.

wbamberg avatar Jun 09 '25 17:06 wbamberg

It's a bit unfortunate here, because http://example.com does not redirect to example.com :(.

In those cases, how about using http://developer.mozilla.org/?

caugner avatar Jun 10 '25 10:06 caugner

I think this is a good idea. (Sorry if this message sounds rude.)

RyoRyo-2010 avatar Jun 10 '25 14:06 RyoRyo-2010

Not at all :)

Josh-Cena avatar Jun 10 '25 14:06 Josh-Cena

I see two possible solutions:

  1. example.com works to illustrate the difference. I assume they don't enforce redirection for the purposes of demonstrating both both http and https. The current URL isn't hyperlinked, but presented as code for example, so any risk is mitigated.
  2. A working URL isn't needed for the illustration, since it isn't hyperlinked and isn't intended to be visited, so a URL with non-valid TLD would be better.

In the second case, and in keeping with the current example and the traditional use of nonsense words in examples, I would suggest something like foobar.baz. (foo dot bar is off the table because bar is a valid TLD).

denmch avatar Jun 12 '25 00:06 denmch

This is what I do myself:

  • Use example.com if I just need a domain name and not any specific behavior about the site itself
  • Use a real site otherwise

So in this case to illustrate HSTS we would use DMO. In other occasions we would likely use example.com. I would prefer to not use a site that seems to not exist for now, because TLDs can be added, especially three-letter ones.

Josh-Cena avatar Jun 12 '25 08:06 Josh-Cena

example.com works to illustrate the difference. I assume they don't enforce redirection for the purposes of demonstrating both both http and https. The current URL isn't hyperlinked, but presented as code for example, so any risk is mitigated.

Yes, we're not actually saying that example.com redirects, so it isn't a fatal problem. Just, like I say, unfortunate and potentially surprising for someone who tries copy/pasting it. I think using DMO is a totally reasonable solution.

wbamberg avatar Jun 12 '25 17:06 wbamberg

I know this repeats what @caugner said, but I’d like to propose using http://developer.mozilla.org/ , since—as @wbamberg mentioned—it actually enforces HSTS and I think it’s a good example to illustrate the concept.

RyoRyo-2010 avatar Jun 14 '25 02:06 RyoRyo-2010

For foo.com and bar.com, foo.example.com and bar.example.com could be used if contrast between two domains is needed (neither exists, but they're still reserved as they lie under the example.com second-level domain).

lionel-rowe avatar Jun 18 '25 22:06 lionel-rowe

Hello @Josh-Cena I want to work on this. But to be on the same page, I will replace it with http://developer.mozilla.org correct?

Bashamega avatar Jun 21 '25 13:06 Bashamega

We should replace this particular one with DMO, yes, but I was saying if we do this then we should replace all other foo.com and bar.com as well, and those should probably be replaced with example.com, unless we are assuming some specific site behavior, in which case we need to find a site that does what it says.

Josh-Cena avatar Jun 21 '25 14:06 Josh-Cena

Note, original problem fixed in https://github.com/mdn/content/pull/39853

Josh-Cena avatar Oct 07 '25 20:10 Josh-Cena