From a8ca472ec3a1d1510000fd83d6904cbd0e9981b5 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Wed, 18 Jul 2012 11:22:22 -0700 Subject: Fix: Improved download UX for cloud app Added a fix to prevent the on close dialog of Chrome from appearing when an user has to download the Ninja Cloud app. Everything should work the same, only no dialog appears when clicking on download. --- js/io/ui/cloudpopup.reel/cloudpopup.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'js') diff --git a/js/io/ui/cloudpopup.reel/cloudpopup.js b/js/io/ui/cloudpopup.reel/cloudpopup.js index 200eb703..914b2105 100755 --- a/js/io/ui/cloudpopup.reel/cloudpopup.js +++ b/js/io/ui/cloudpopup.reel/cloudpopup.js @@ -117,11 +117,21 @@ exports.CloudPopup = Montage.create(Component, { downloadCloudApp: { enumerable: false, value: function() { + //Creating an empty anchor to link to download file + var link = document.createElement('a'), evt = document.createEvent("MouseEvents"); + link.download = 'Ninja-Local-Cloud'; + this.element.appendChild(link); + //Creating a fake click event to init file download + evt.initMouseEvent("click", true, true, window, 1, 0, 0, 0, 0,false, false, false, false, 0, null); + //Setting proper download file based on OS if(this._os === 'mac') { - location.href = '/ninja_localcloud_for_mac.zip'; + link.href = '/ninja_localcloud_for_mac.zip'; + link.dispatchEvent(evt); } else if (this._os === 'windows') { - location.href = '/ninja_localcloud_for_windows.zip'; + link.href = '/ninja_localcloud_for_windows.zip'; + link.dispatchEvent(evt); } else { + //Alerting user their OS is not supported alert('Your operating system is not supported by the Ninja Local Cloud App.'); } } -- cgit v1.2.3