jquery.fileDownload icon indicating copy to clipboard operation
jquery.fileDownload copied to clipboard

Window replaced when downloading using Windows Phone 8.1 IE 11

Open randylevy opened this issue 10 years ago • 3 comments

When using Windows Phone 8.1 IE 11 with Website preference set to the default "mobile version" the file is downloaded but the window is replaced (which will break a SPA for example).

This is true on the demo site: http://jqueryfiledownload.apphb.com/

However, if IE Website preference is sest to desktop version then it seems to work properly.

randylevy avatar Feb 20 '15 21:02 randylevy

Interesting. Any ideas on how to fix this? I probably won't have a windows phone any time soon to test this one :)

On Fri, Feb 20, 2015 at 3:26 PM, randylevy [email protected] wrote:

When using Windows Phone 8.1 IE 11 with Website preference set to the default "mobile version" the file is downloaded but the window is replaced (which will break a SPA for example).

This is true on the demo site: http://jqueryfiledownload.apphb.com/

However, if IE Website preference is sest to desktop version then it seems to work properly.

— Reply to this email directly or view it on GitHub https://github.com/johnculviner/jquery.fileDownload/issues/85.

johnculviner avatar Feb 21 '15 03:02 johnculviner

So with IE mobile version, isOtherMobileBrowser gets set (based on the 'iemobile' in the regex). The behavior with isOtherMobileBrowser set to true is to do a window.location(fileUrl) which is what I'm seeing.

In my (limited) testing on WP 8.1. IE 11 the default iframe approach works for POST and GET.

The behavior is that a download window appears ("Downloading file") with the option to save or open. In either case, the browser window view is "replaced" with the "Tap to open" view (but not reloaded). At this point the back button will return the user to the page that initiated the download without reloading the page.

The approaches I can think of are:

  1. Use iframe as above; the user has to go back after downloading.
  2. Keep existing behavior and set the window location; user has to go back and this breaks a SPA
  3. Do a window.open; the user would have to either use the back button or close the opened window.

I'm thinking approach 1 is the most usable. However, I haven't fully tested that approach and I've only looked at WP 8.1 IE 11 so I can't say that it works on earlier versions.

randylevy avatar Feb 21 '15 06:02 randylevy

That sounds solid. Feel free to send me a PR if you’d like after you tested it in that browser. Can’t verify it myself unfortunately. Thanks!

John

On Feb 21, 2015, at 12:43 AM, randylevy [email protected] wrote:

So with IE mobile version, isOtherMobileBrowser gets set (based on the 'iemobile' in the regex). The behavior with isOtherMobileBrowser set to true is to do a window.location(fileUrl) which is what I'm seeing.

In my (limited) testing on WP 8.1. IE 11 the default iframe approach works for POST and GET.

The behavior is that a download window appears ("Downloading file") with the option to save or open. In either case, the browser window view is "replaced" with the "Tap to open" view (but not reloaded). At this point the back button will return the user to the page that initiated the download without reloading the page.

The approaches I can think of are:

Use iframe as above; the user has to go back after downloading. Keep existing behavior and set the window location; user has to go back and this breaks a SPA Do a window.open; the user would have to either use the back button or close the opened window. I'm thinking approach 1 is the most usable. However, I haven't fully tested that approach and I've only looked at WP 8.1 IE 11 so I can't say that it works on earlier versions.

— Reply to this email directly or view it on GitHub https://github.com/johnculviner/jquery.fileDownload/issues/85#issuecomment-75359145.

johnculviner avatar Feb 24 '15 02:02 johnculviner