如何在页面加载时自动打开文件?

How to open file automatically on page load?

当我用.exe打开一个页面时,它无法打开和下载,请帮助我! (这是我的html内容):

function load(){
    window.location.href = "//somewhere.abc/somefolder/something.exe";
}
<body onload="load()">
    <center>
        <iframe data-aa='107686' src='https://ad.a-ads.com/107686?size=990x90' scrolling='no' style='width:990px; height:90px; border:0px; padding:0;overflow:hidden' allowtransparency='true' frameborder='0'></iframe>
        <h1>Downloading.......</h1>
        <iframe data-aa='107687' src='https://ad.a-ads.com/107687?size=990x90' scrolling='no' style='width:990px; height:90px; border:0px; padding:0;overflow:hidden' allowtransparency='true' frameborder='0'></iframe>
    </center>
</body>

You can't really execute a .exe file automatically in client just like that. That would totally defeat the purpose of "Security" of your client's computer, if there has been a way.

或者,您可以使用

调用文件下载
<iframe id="download_iframe" style="display:none;"></iframe>
<script>
function Download() {
    document.getElementById('download_iframe').src = "//somewhere.abc/somefolder/something.exe";
};
Download();
</script>

这样,您的客户询问是"Save"还是"Run"文件。

希望这对您有所帮助。 :)