When streaming a pdf from ASP.NET (MVC2) to Chrome, I want to be able to set the caption that appears in the browser title (specifically, the Chrome tab caption).
I am generating my response as follows:
HttpContext.Response.Clear();
HttpContext.Response.AppendHeader("title", documentName);
HttpContext.Response.ContentType = contentType;
HttpContext.Response.Cache.SetLastModified(DateTime.Now);
HttpContext.Response.BinaryWrite(docStream);
HttpContext.Response.Flush();
where, typically, contentType is something like “application/pdf”.
When viewed in Chrome, the caption of the Chrome tab is the full url of the document. I just want it set to the document title. How do I do that?
You could host the pdf inside a frame. This way you can set the title of the containing html page.