Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Internet explorer和edge尝试以html格式下载文件_Html_Apache_Download - Fatal编程技术网

Internet explorer和edge尝试以html格式下载文件

Internet explorer和edge尝试以html格式下载文件,html,apache,download,Html,Apache,Download,我有一个apache服务器,它提供一个html页面,内容如下: <html> <head> <link href="meta/style.css" rel="stylesheet" type="text/css" charset="UTF-8"> </head> <body> <h1>Welcome</h1&g

我有一个apache服务器,它提供一个html页面,内容如下:

<html>
<head>
    <link href="meta/style.css" rel="stylesheet" type="text/css" charset="UTF-8">       
</head>
<body>
    <h1>Welcome</h1>
    
    <p><b><li>Welcome to download page</b></li> 
    </p>
    <p>
    <a href="file1.7z">file1.7z</a><br><br> 
    <a href="file2.7z">file2.7z</a>
    </p>
</body>
</html>

欢迎
  • 欢迎下载页面


  • 当我点击file1.7z或file2.7z链接时,chrome开始将其下载为7z文件,但internet explorer和edge试图将其下载为html文件。如果在“另存为”对话框中选择“所有文件”,并将扩展名更改为7z,则下载的文件是有效的7z文件

    我已经发现了一个属性,它可能会修复Edge的问题,但看起来Internet explorer和其他浏览器甚至不支持这个功能


    是否有任何apache服务器配置可以设置,或者可以添加到html页面的标题中,以强制所有浏览器将其作为7z文件下载?

    @user13267听起来您可能需要添加MIME类型:application/x-7z-compressed

    我认为您需要在服务器上通过以下路径执行此操作:


    /etc/apache2/mods enabled/mime.conf

    @user13267听起来您可能需要添加mime类型:application/x-7z-compressed

    我认为您需要在服务器上通过以下路径执行此操作:


    /etc/apache2/mods enabled/mime.conf

    您是否尝试过使用download属性查看它是否在IE中工作?此外,如果右键单击文件并“另存为”,会发生什么情况?在Edge、IE和您需要的浏览器上,它会这样工作吗?您需要添加MIME类型:application/x-7z-compressed吗?我想您需要在这里这样做:/etc/apache2/mods enabled/mime。conf@finiteloop添加MIME类型works@finiteloop当然,您是否尝试过使用下载属性来查看它是否在IE中工作?此外,如果右键单击文件并“另存为”,会发生什么情况?在Edge、IE和您需要的浏览器上,它会这样工作吗?您需要添加MIME类型:application/x-7z-compressed吗?我想您需要在这里这样做:/etc/apache2/mods enabled/mime。conf@finiteloop添加MIME类型works@finiteloop当然