dcsimg
www.webdeveloper.com
Results 1 to 8 of 8

Thread: 2 html files in ONE server reply

  1. #1
    Join Date
    Jan 2013
    Posts
    4

    2 html files in ONE server reply

    Hello everyone,
    I know that every single html file has to have exactly ONE <html>...</html> part.
    But is it OK to send a sequence of such files all in one http reply?
    No browser I've tested so far did ever complain, results look nice.

    But do I violate any standards this way?
    Haven't found any answers (w3c.org,...) yet.

  2. #2
    Join Date
    Mar 2011
    Posts
    1,159
    Yes, you have violated the basic standards of both HTTP and HTML. Browsers will do their best to render whatever data is sent to them, regardless of any violations of various standards. So when you're sending multiple files at once, the browser simply treats it as a single HTML file and renders them all - one after the other.

    For simple layouts, you'll probably get reasonably readable results, but sooner or later this practice will cause problems for you. You need to find a way to assemble everything into a single, valid HTML file.

  3. #3
    Join Date
    Mar 2012
    Posts
    1,817
    An alternative to building one file would be to make them PHP include files. This is particularly useful for repetitive information that you want to appear on multiple web pages. That way when the info changes, you only have to amend it once and all the pages are updated.

  4. #4
    Join Date
    Jan 2013
    Posts
    4
    OK, I won't do it again, I promise ;-)

    At least---as this was only a quick-n-dirty solution for my own use, I haven't done any harm to the world.

    But now I'm still curious: You seem to know an authoritative source. Could you please point me to it?

    Thanks in advance!

  5. #5
    Join Date
    Jan 2013
    Posts
    4
    Quote Originally Posted by tilman victor View Post
    OK, I won't do it again, I promise ;-)

    At least---as this was only a quick-n-dirty solution for my own use, I haven't done any harm to the world.

    But now I'm still curious: You seem to know an authoritative source. Could you please point me to it?

    Thanks in advance!
    ^This^ was meant to be a reply to rtrethewey (#2 above).
    How can i do this right next time?

  6. #6
    Join Date
    Mar 2011
    Posts
    1,159
    jedaisoul's suggestion about "include"s is one solution. It all depends on what you're trying to accomplish. Why are you using multiple files?

  7. #7
    Join Date
    Jan 2013
    Posts
    4
    Oh, sorry!
    I really don't WANT to do that.

    (What I, forum-newbie, would like to "do right next time" is to reply to
    a specific post instead of writing beneath the whole thread.)

    The story is just the other way round:
    For quite a while I was working with a concatenation of originally stand-alone html-snippets and was happy to see everything in one place.
    Then one day I looked at the source...

    But, just for the sake of curiosity---as promised, I won't do it in public:

    After all, isn't what we call a html-document perfectly encapsulated by
    <html>...</html>?
    And once the http is done (CRLF,CRLF), isn't it OK to send whatever you
    have announced as "content-type:" as many times as you like?

    Does anyone know an authoritative source for further reading?
    My every-search-engine-I-know-foo seems to be very very weak...

  8. #8
    Join Date
    Jan 2013
    Posts
    22

    linux virtual private server

    ya
    it is possible in programming language there is
    combine two <html> files in one .....

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles