HTML重定向以下载exe文件

时间:2016-04-20 07:38:25

标签: php html redirect

我想重定向到下载exe文件。在Internet Explorer中,如果我想运行或保存文件,浏览器会自动询问我。在chrome中只获取保存为文件。如何在Chrome中使用与IE相同的功能?

谢谢

   <!DOCTYPE html>
<html>
<head>
<?php
 $file_url = 'file://suas105/deployment/PnS_Token_WIPG-300H/WIPG-300H/WIPG-300H.exe';
header('Content-Type: application/octet-stream');
header("Content-Transfer-Encoding: Binary"); 
header("Location: $url");
header("Content-disposition: attachment; filename=\"" . basename($file_url) . "\""); 
readfile($file_url);
?>
<!--<meta charset="UTF-8">
<meta http-equiv="refresh" content="1; url=file://suas105/deployment/PnS_Token_WIPG-300H/WIPG-300H/WIPG-300H.exe" />-->
<title>Page redirection</title>
</head>
<body>
   <!--If you are not redirected automatically, follow the <a href='file://suas105/deployment/PnS_Token_WIPG-300H/WIPG-300H/WIPG-300H.exe' download>link to example</a>-->
</body>
</html>

0 个答案:

没有答案