1

I am reading about internet and stuff and just learned that web pages are really just HTML files.

Also, I have learned that HTTP is just a transfer protocol.

So my question is, would it be possible to view a web page using another protocol, say FTP, since a webpage is really just a file with instructions in it telling the browser how to render the page?

If it would be possible, could you describe how it would be possible?

Example: Let's say that a server hosts a webpage on port 20 (that is: FTP port). If I connected to the server with: ftp://<hostname>/<path_to_webpage>, would I be able to display it as expected?

Yet more interestingly, in the same scenario, if I connected to the server with: http://<hostname>:20/<path_to_webpage>, would it work in this scenario as well?

3
  • Yes, your browser is probably capable of using the FTP protocol for transferring files. See for example ftp://speedtest.tele2.net, your browser uses the FTP protocol to list the files and generates a HTML page to display this list to you. ftp://speedtest.tele2.net:21 works exactly the same. It is not possible to mix the HTTP and FTP protocols. Your second scenario won't work, though your browser may be able to determine that the remote server uses ftp and thus uses ftp to communicate further. Chrome however tells meERR_UNSAFE_PORTwhen I try to connect to speedtest.tele2.net:21 Nov 5, 2015 at 13:53
  • HTTPS anyone? (need some extra characters) Nov 5, 2015 at 21:57
  • Try saving an HTML web page to your hard drive and loading it from disk. What protocol is that?
    – user22815
    Nov 6, 2015 at 3:49

3 Answers 3

7

Yes. You can transmit HTML over any medium that can transmit text. Email, for example. I'm willing to bet that at least 90% of all emails you receive, and probably also most that you write, are HTML. You can also view HTML files on your local filesystem.

The browser doesn't care at all how the HTML arrived on your system. That's "someone else's problem".

Let's say that a server hosts a webpage on port 20 (that is: FTP port). If I connected to the server with: ftp://<hostname>/<path_to_webpage>, would I be able to display it as expected?

Yes, provided the server is actually running an FTP server on port 20.

Yet more interestingly, in the same scenario, if I connected to the server with: http://<hostname>:20/<path_to_webpage>, would it work in this scenario as well?

No, of course not. We are assuming that the server is running an FTP server on port 20, not an HTTP server, so obviously you can't talk HTTP to it.

If there's an FTP server listening on port 20, then the first one will work. Since there is an FTP server listening on port 20, there cannot be an HTTP server listening on port 20, so the second one will not work.

If there's an HTTP server listening on port 20, then the second one will work. Since there is an HTTP server listening on port 20, there cannot be an FTP server listening on port 20, so the first one will not work.

If there's neither an FTP nor an HTTP server listening on port 20, neither of the two will work.

None of this has anything to do with HTML. The HTTP or FTP client doesn't care what it is downloading. The HTML renderer doesn't care where the HTML came from.

5
  • What about the scenarios I gave in the Example section? Would they work or would they fail? And why in either case?
    – Utku
    Nov 5, 2015 at 13:57
  • 1
    The browser most likely contains a 'file downloader' and 'file renderer'. You type an addres, the 'file downloader' downloads the file and passes it to the 'file renderer' which transforms it into something on your screen. Only the 'file downloader' is concerned with the protocols (http, ftp, smb, etc.) Nov 5, 2015 at 13:58
  • Neither of the two cases has anything to do with HTML. If there is an FTP server listening on port 20, then you can connect to it via FTP. If there isn't, then you can't. If there is an FTP server listening on port 20, then there can't be an HTTP server listening on port 20, so you obviously can't connect to port 20 via HTTP. Nov 5, 2015 at 14:00
  • Interestingly enough and very tangentially, if there is enough information in the client-initiated handshake to identify the kind of connection, you can have multiple services on a single port by having a program that disambiguates and forwards the connection to the right kind of protocol handler. ZNC uses this to have the WebAdmin UI and the IRC bouncer on the same user-defined port. Nov 5, 2015 at 14:14
  • @JörgWMittag One minor question: If there is an HTTP server running on port 20 and nothing is running on port 80, then http://<hostname>/<path_to_webpage> won't work right? Because the browser considers the port to be 80 when the port is not specified and the scheme is HTTP.
    – Utku
    Nov 5, 2015 at 14:15
1

You are confused.

Transferring a HTML page is possible with any protocol that can handle text - email, RSS, ftp, the list is endless. Viewing a HTML page is completely different: it requires code that interprets the tags and generates the corresponding characters. This is called a renderer, and only a HTML renderer can perform this task.

A web browser is simply a piece of software that combines both functionalities, because it's so useful to combine them. So yes, you can transfer a web page without a browser, but no, you normally can't view it without a browser, because most HTML renderers live in browsers.

1
  • I have made an edit to my question. Could you check it out?
    – Utku
    Nov 5, 2015 at 13:45
1

Earlier web browsers supported multiple protocols, including ftp and gopher for example. With the advent of AJAX, the web has been much more closely linked to http(s) as the required protocol.

HTML itself however, has no requirement regarding the transport protocol.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.