I have created an ASP.Net application page to handle opening FileSite links. There is a custom protocol which is handling the links correctly, i.e it opens the files, however it leaves me with an empty browser page as the file is launched.
I have 3 scenarios I am working with
- Links directly to the handling page will launch the file and close the browser
- Links from another page on the Intranet will launch handling page, open the file and return to the originating page
- Links from a dialog on the Intranet open the handling page, launch the file and then close the handling page
The code I have is the following (Codebehind is setting the FileUrl and choosing which function to call of the two)
<script type="text/javascript" language="javascript">
// Files opened directly from link
function OpenFileSiteLink() {
window.location.href = '<%= FileUrl %>';
}
// Files opened from within Intranet
function OpenFileSiteLinkReferrer(referrer, dialogOpened) {
window.open('<%= FileUrl %>');
if (dialogOpened) {
window.open('close.html', '_self');
} else {
window.location.href = referrer;
}
}
</script>
The code in the close.html file has only the following
<script type="text/javascript"> window.close();</script>
This was taken from How can I close a browser window without receiving the "Do you want to close this window" prompt?
Any suggestions how I can open the protocol to launch the application without the additional dialog would be appreciated