如何停止嵌入式HTML文件的下载? [英] How to stop embedded HTML files from downloading?

查看:70
本文介绍了如何停止嵌入式HTML文件的下载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在<iframe>标记中有一个.html文档.假设它被称为FILE.html并且托管在http://files.net/FILE.html.

I have a .html document that I need in an <iframe> tag. Let's say it is called FILE.html and is hosted at http://files.net/FILE.html.

因此,我这样编写iframe广告代码: <iframe src="http://files.net/FILE.html"></iframe>

So, I write the iframe tag as such: <iframe src="http://files.net/FILE.html"></iframe>

iframe不会显示为一个漂亮的小框并在FILE.html中呈现html,而是打开文件资源管理器"并提示用户下载FILE.html.我不希望他们下载它,只希望他们在屏幕上看到它.

Instead of the iframe appearing as a nice little box and rendering the html in FILE.html, it instead opens File Explorer and prompts the user to download FILE.html. I don't want them to download it, I just want them to see it rendered on their screen.

所以我有办法格式化它,以便html呈现而不下载吗?是否可以更改FILE.html或iframe广告代码或以其他方式上传它?

So is there a way for me to format it such that the html renders and doesn't download? Can I change the FILE.html, or change the iframe tag, or upload it in a different way?

推荐答案

关于文件的提供方式,某件事告诉浏览器它不是可以显示的HTML文件.这可能是因为其Content-Type标头不正确,也可能是因为该文件带有指示浏览器下载它的Content-Disposition标头.

Something about the way that file is being served is telling the browser that it isn't an HTML file that can be displayed. This is probably because its Content-Type header is incorrect, but may also be because the file is being served with a Content-Disposition header that instructs the browser to download it.

假设您有权访问提供此文件的服务器,则需要将其配置为使用正确的头.无法覆盖帧中的这些标头.

Assuming that you have access to the server that this file is being served from, you will need to configure it to use the correct headers. There is no way to override these headers in a frame.

这篇关于如何停止嵌入式HTML文件的下载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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