I have an application which shows some static files for download. This application creates an hidden iframe and set the source to the file-url.
The browser shows a save-as dialog.
But within Microsoft Office there is no save-as dialog and the filedownload is not started.
The file is served with Content-Disposition: Attachment
. The working solution will simply open a new browser instance and trigger the file download. I don't want to open a new window which will gain focus.
<!DOCTYPE html>
<html>
<head>
<script>
function di(){
document.getElementById("d").src="blob.dat";
}
</script>
<title>download</title>
</head>
<body>
<h1>file loading</h1>
<h2>works</h2>
<p>But opens a new window</p>
<a href="blob.dat" target="_blank"> a blank </a><br>
<a href="blob.dat" target="download"> named frame </a>
<h2>won't work</h2>
<a href="blob.dat"> a self </a><br>
<a href="blob.dat" target="_self"> a self </a><br>
<a href="blob.dat" target="_top"> a top </a><br>
<a href="#" onclick="di();"> iframe </a><br><br>
<iframe id="d"></iframe>
</body>
</html>
I think it is a serius bug, if a web-application is unablle to follow links.