Pregunta

Let's say I have a normal iframe with some standard attributes:

<iframe width="300" height="300" src="http"></iframe>

What will this src="http do? I've seen it around but I don't exactly know what http will point to or what this iframe will now fetch.

¿Fue útil?

Solución

It will request a file called "http" relative to the current path.

Otros consejos

The attribute src="http" refers to a resource with the relative URL http. Relative URLs are resolved relative to the current base URL, which is by default the URL of the document itself but can be set with a base element.

Resolution of relative URLs is normatively specified in STD 66. For example, if the URL of the document http://www.example.com/foo/bar/fun.html and there is no base element, then the attribute src="http" is equivalent to src="http://www.example.com/foo/bar/http".

With a colon that specifies the protocol that the rest of the mandatory url (uniform resource location), hyper text transport protocol in this case. Other types of protocol include https, ftp, ftps, mailto and more. At one time, gopher was "popular".

Without a colon, e.g. as asked, @recursive is correct.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top