防止iframe下载SWF文件 [英] Prevent iframe Download SWF Files

查看:164
本文介绍了防止iframe下载SWF文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iframe标记里面有一个swf文件

 < iframe width =800height =600frameborder =0src =http://domain.com/swf-files/blabla.swf>< / iframe>如果用户没有Flash播放器(或禁用插件或浏览器不支持等)。 。)浏览器试图下载这个文件。



这个代码适用于安装了flash player插件的浏览器。



如果Flash Player未启用,如何防止下载此文件?我不在乎保护文件。我只是想播放文件,如果Flash播放器启用(我可以做到这一点)。如果Flash播放器没有启用,只需显示一个消息,如你没有插件,你不能通过浏览器查看这个文件。

解决方案



请记住,任何文件扩展名不是被浏览器识别出来只是下载,但是< embed> 标签实际上检测到了兼容性。


I have a swf file inside an iframe tag

<iframe width="800" height="600" frameborder="0" src="http://domain.com/swf-files/blabla.swf"></iframe>

If user doesn't have a flash player (or disabled the plugin or browser doesn't support etc.) browser tries to download this file.

This code works fine with browsers which have flash player plugin installed.

How can I prevent this file to be downloaded if flash player is not enabled? I don't care about securing the file. I just want to play the file if flash player enabled (I can do this). If flash player is not enabled, just show a message like "you don't have the plugin, you can't view this file through your browser"

解决方案

You should embed the .swf onto an html page then use the iframe to load the html.

Remember that any file extensions that aren't recognized by the browser just get downloaded, but the <embed> tag actually detects compatibility.

这篇关于防止iframe下载SWF文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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