Word 2007 文件啟動新窗口而不是顯示內聯 (Word 2007 files launching new window instead of displaying inline)


問題描述

Word 2007 文件啟動新窗口而不是顯示內聯 (Word 2007 files launching new window instead of displaying inline)

我有一個網絡應用程序,它允許用戶上傳文件,然後在瀏覽器中查看它們。這是通過將它們與 IFrame 內聯顯示來完成的。這適用於所有文件類型(例如 .doc、.xls、.pdf),但 Office 2007 格式 .docx 和 .xlsx 除外,它們在新窗口中啟動應用程序。

我正在使用這些“Content‑Type”標頭的值:

docx ‑ "application/vnd.openxmlformats‑officedocument.wordprocessingml.document"
xlsx ‑ "application/vnd.openxmlformats‑officedocument.spreadsheetml.sheet"

“Content‑Disposition”標頭是“inline; filename=example.docx”。

這是一個經典的 ASP 腳本,它在響應中返回原始文件,通過 IFrame 的“src”屬性請求並由 IIS 6 提供服務。我的 PC 上沒有安裝 Office 2007,但我確實有 Office 2007 兼容包。但是,這也已在具有 Office 2007 的客戶端上進行了測試,但問題仍然存在。

如何強制這些文件類型在瀏覽器中內聯打開而不是打開新窗口?

任何幫助表示讚賞。

編輯:

我應該提到這只需要在 IE8 中工作。


參考解法

方法 1:

<p>@Lee D: Even though you're explicitly setting the Content‑Type (and have the Office 2007 Compatibility Pack installed on your PC), I think you should add those MIME types to your web server (it's in IIS Manager under Server Properties and then MIME Types) to see if that's the missing ingredient.</p>

(by Lee Dstealthyninja)

參考文件

  1. Word 2007 files launching new window instead of displaying inline (CC BY‑SA 3.0/4.0)

#iframe #ms-office #mime-types #asp-classic






相關問題

IE6 iframe 渲染問題 (IE6 iframe rendering issue)

Cross Domain JavaScript parent location setting firefox error (Cross Domain JavaScript parent location setting firefox error)

Перанакіраванне ад даччынага акна да бацькоўскага ў iframe з дапамогай javascript (OAuth) (Redirecting from child window to parent to a iframe using javascript (OAuth))

Tương tác với trình phát youtube được nhúng của học viện Khan (Interacting with Khan academy's embedded youtube player)

創建文件並將其加載到 iframe (creating file and load it in iframe)

Firefox 無法訪問同一域上的 iframe 打印 (Firefox can't access iframe print on the same domain)

如何在特定情況下處理 iframe。如何處理 iframe 內容? (How to handle iframe in particular situation. How to handle iframe contents?)

使用 jQuery 按鈕單擊更改 iFrame 的 URL? (Change URL of iFrame with jQuery button click?)

如何使網頁只允許 iframe 訪問 (How to make web page only allowed accessed by iframe)

為什麼 Internet URL 在 iframe 標記中不起作用? (Why is an Internet URL not working in an iframe tag?)

Word 2007 文件啟動新窗口而不是顯示內聯 (Word 2007 files launching new window instead of displaying inline)

有沒有辦法在 <IFrame> 中嵌入網站,如果它拒絕嵌入? (Is there any way to embed a website in <IFrame>, If it is denying to be embedded?)







留言討論