Can anybody tell me why this works?

Discussion in 'Javascript' started by The Natural Philosopher, Dec 11, 2008.

  1. Its not really javascript, or php, or excuse posting it here.

    I have a form.

    On submission it submits to itself, so the normal behaviour is to pass
    the data back to the server, do something server side, and redraw itself
    with the exact data it had before it was submitted.

    Nothing new there.

    However one option was to instead of drawing itself, send a downloadable
    object: To this end, serverside, instead of sending an updated HTML
    version of itself, it sends some headers, and some data as a file
    download. And that is ALL it sends.

    Now I would have thought that this would in some way cancel the existing
    window with the form in it, but it seems that all the browsers I have
    tested against take this response - a file rather than an HTML document,
    being sent, as a directive to spawn a separate download dialogue box,
    and eve the main screen unaltered.

    This is in fact exactly what I wanted, and saves me the trouble of
    working out how to split the session into two browser windows - getting
    the main window back and having a download happen, but can I rely on this?

    Is it guaranteed behaviour to some standard, or just 'the way
    firefox/safari/IE7 work'?

    Apologies for asking here, but I don't even now where to LOOK for the
    The Natural Philosopher, Dec 11, 2008
    1. Advertisements

  2. The Natural Philosopher

    Henry Guest

    If there is a positive assertion about how a user agent should handle
    a response with a MIME type that it cannot directly display it will be
    in RFC 2616 - Hypertext transfer Protocol - HTTP/1.1.
    Henry, Dec 11, 2008
    1. Advertisements

  3. The Natural Philosopher

    David Mark Guest

    What else is new? But since this is a question, no excuse is needed
    (assuming it is a good question.)
    Yes. That sounds familiar.
    It might surprise you that you can do that with an HTML document as
    There is a standard header for this (Content-Disposition.)
    How about the specifications for the HTTP protocol? And please post
    future queries about this (or anything for that matter) elsewhere.
    Thank you for your cooperation.
    David Mark, Dec 11, 2008
  4. Ah. Thanks for that at least.
    The Natural Philosopher, Dec 11, 2008
  5. Sadly no info I could easily find was relevant.

    Does anyone know of an HTTP client that will when given a URL, just show
    me what headers are being sent? even if its a file download/image
    download target?
    The Natural Philosopher, Dec 11, 2008
  6. The Natural Philosopher

    David Mark Guest

    I gave you the name of the header and told you this topic was OT here.
    David Mark, Dec 11, 2008
  7. The Natural Philosopher

    Jorge Guest

    Yes: the "net" pane of firebug: in order to monitor any/every network
    transaction, click on "net" (a popup will appear) and select "enable
    monitor for (domain)".

    Or the "resources" pane of the "web inspector" of a *nightly build* of
    Webkit: (
    Jorge, Dec 12, 2008
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.