javascript - Blob URL not working on Android Browsers -


i've created simple web app using .net (with entity framework) , angularjs retrieve pdf files. i'm able have app work on desktop browsers , ios browsers. unfortunately i'm having issues getting work on android browser.

inside controller function triggered ng-click on simple button requests , displays pdf. able use solution here pdf's working correctly on ios , edge browsers.

appmodule.controller("cellcontroller", ['$scope','$http','$routeparams','$window','$sce', function ($scope, $http, $routeparams,$window,$sce) { .... $scope.getlayout = function () {     var attachmentpromise = $http.get("/api/pdf" + $routeparams.id, { responsetype: 'blob' }).then(function (result) {                                             var file = new blob([result.data], { type: 'application/pdf' });         if (window.navigator.mssaveoropenblob) {             window.navigator.mssaveoropenblob(file, "layout.pdf");         }         else if (window.navigator.useragent.match('crios')) {             var reader = new filereader();             reader.onloadend = function () { $window.open(reader.result); };             reader.readasdataurl(file);         }         else if (window.navigator.useragent.match(/ipad/i) || window.navigator.useragent.match(/iphone/i)) {             var url = $window.url.createobjecturl(file);             window.location.href = url;         }         else {             var url = window.url || window.webkiturl;             window.open(url.createobjecturl(file));         }     }); }; }]); 

as mentioned above above code works on desktop , ios, either open blank blob page on android or fail download file on android.

any suggestions on appreciated :).

let me know if can provide additional information


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -