在iframe中显示消息,如果有无法显示的.doc文件 [英] Display message in iframe, if there is a .doc file which cannot be displayed

查看:338
本文介绍了在iframe中显示消息,如果有无法显示的.doc文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用iframe在页面上显示pdf或doc文件。 PDF毫无疑问地显示完美,但doc文件刚下载,我知道为什么。

I am using iframe to display pdf or doc file on the page. pdf without any doubt displayed perfectly but doc file just downloaded and i am aware why.

现在的问题是我想在iframe中显示该文件是一个文档文件无法显示,需要下载才能查看。

Now the problem is I want to display a message in iframe that the file was a doc files so cannot be displayed and need to be downloaded to view.

直到现在我已经搜索并找到各种解决方案来显示一条消息或加载iframe时发生的任何事情,但我想在这里它不是加载任何东西的情况。

till now I have searched and found various solutions to display a message or anything while loading iframe but I guess here its not the case of loading anything.

这里是 fiddle

here is fiddle

推荐答案

我无法找到任何解决方案在iframe中显示消息,可能它不提供,所以我切换到对象标记。

I couldn't find any solution to display message in iframe, may be it doesn't provide, so I switched to object tag.

<object data="[path to .doc]" type="application/msword">
<p>It appears you do not have a Suitable plugin for this browser. You can download this file.
    <a href="[path to .doc]">
    <button type="button">download</button></a>
</p>

这篇关于在iframe中显示消息,如果有无法显示的.doc文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆