1

FireFox Shows Pop up for open or Save Dialog.

<iframe id="appFrame" runat="server" style="height: 95%; width: 100%; border: 0px;
                    z-index: -123;"></iframe>

I am using iframe to display word document,

document.getElementById("ctl00_GridContentPlaceHolder_appFrame").src = "ResponseWriter.aspx?docid=" + docId + "&doctype=" + docType + "&type=" + type;

I am calling ResponseWriter.aspx to write bytes it works well in IE but not in Firefox,Here is the code of ResponseWriter.aspx

        Response.ClearHeaders();
        Response.ClearContent();
        Response.AddHeader("MIME Type", type.Trim()); 
        Response.AppendHeader("content-disposition",
                "inline;attachment; filename=" + "Unknown." + docType);

        Response.AddHeader("Content-Length", _fileArray.Length.ToString());
        Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
        Response.ContentType = type.Trim();
        Response.BinaryWrite(_fileArray.ToArray());
        Response.End();

Can any one please help me.

Ramakrishnan
  • 5,254
  • 9
  • 34
  • 41
  • 1
    What is the problem you are having? You didn't say. Can you post the code that actually returns the file? – Oded May 23 '11 at 12:29

1 Answers1

2

This is probably because Office has installed some hooks into IE to support "in browser" viewing of Office documents, while Firefox, Chrome, etc. just send the bytes to the Office application.

Without seeing more details of the way "ResponseWriter.aspx" is sending the bytes to the stream and what behaviour you're seeing in Firefox, there's not much more I can guess at the moment.

As a point of note, you should probably look into using a request handler (.ashx) instead of the .aspx page - this has a cleaner model for these sorts of requests as it doesn't use most of the page life-cycle.

Zhaph - Ben Duguid
  • 26,785
  • 5
  • 80
  • 117
  • 3
    And just to be explicit — if the visitor doesn't have a browser plugin for rendering Office documents, then you can't make their browser render an Office document. – Quentin May 23 '11 at 13:10
  • I have updated my question,Could you please give me suggestion – Ramakrishnan May 25 '11 at 08:01
  • Firefox just won't display them in-browser. I believe the content-disposition header is really an email header that the IE team implemented some support for - Firefox didn't bother it would appear. http://stackoverflow.com/questions/1012437/uses-of-content-disposition-in-an-http-response-header – Zhaph - Ben Duguid May 25 '11 at 08:20