Jonathan
Jonathan

Reputation: 77

How to explicitly state the port number in an absolute URL?

The question I'm working on:

Now, I (approximately) do most of this:

<img src="http:/webpages/resources/img/logo.jpg">

However I cannot find an example of how or where to specify the port number using a path like this.

Could anyone help point out to me where to include it? (And also if my progress above is actually correct?)

Upvotes: 0

Views: 12605

Answers (2)

unor
unor

Reputation: 96607

The port comes directly after the hostname, separated by :.

http://example.com:80/
http://example.com:80/path

Relevant specifications:

Upvotes: 4

luispa
luispa

Reputation: 323

http = Hypertext Transfer Protocol, use port 80 as default. You don't need to put :80 after the domain.

You need '/' after the http protocol:

<img src="http://webpages/resources/img/logo.jpg">

If the image is on the same server, you can use this:

<img src="resources/img/logo.jpg">

You're pointing to the resources folder, if your folder is on a lower folder level, you can use:

<img src="../resources/img/logo.jpg">

Upvotes: 0

Related Questions