File tree Expand file tree Collapse file tree 1 file changed +26
-3
lines changed
src/main/resources/static/js Expand file tree Collapse file tree 1 file changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -416,6 +416,22 @@ jQuery(document).ready(function() {
416
416
event . stopPropagation ( ) ;
417
417
event . preventDefault ( ) ;
418
418
419
+ // Special handling for MS Explorer Download file window
420
+ function createDownloadWindowMSExplorer ( filename , url ) {
421
+
422
+ var blob = null ;
423
+ var xhr = new XMLHttpRequest ( ) ;
424
+ xhr . open ( "GET" , url ) ;
425
+ xhr . responseType = "blob" ;
426
+ xhr . onload = function ( )
427
+ {
428
+ blob = xhr . response ;
429
+ window . navigator . msSaveBlob ( blob , filename ) ;
430
+ }
431
+ xhr . send ( ) ;
432
+ }
433
+
434
+ // HTML5 Download File window handling
419
435
function createDownloadWindow ( filename , url ) {
420
436
var pom = document . createElement ( 'a' ) ;
421
437
pom . setAttribute ( 'href' , url ) ;
@@ -430,9 +446,16 @@ jQuery(document).ready(function() {
430
446
pom . click ( ) ;
431
447
}
432
448
}
433
-
434
- createDownloadWindow ( "SubscriptionsTemplate.json" , "\/download\/subscriptiontemplate" ) ;
435
-
449
+
450
+ // If MS Internet Explorer -> special handling for creating download file window.
451
+ if ( window . navigator . msSaveBlob ) {
452
+ createDownloadWindowMSExplorer ( "SubscriptionsTemplate.json" , "/download/subscriptiontemplate" ) ;
453
+
454
+ }
455
+ else {
456
+ // HTML5 Download File window handling
457
+ createDownloadWindow ( "SubscriptionsTemplate.json" , "\/download\/subscriptiontemplate" ) ;
458
+ }
436
459
} ) ;
437
460
// /END ## get_subscription_template #################################################
438
461
You can’t perform that action at this time.
0 commit comments