Vue.js 파일 다운로드시 모바일 전체화면 해제되지 않게 처리


Vue.js 파일 다운로드시 모바일 전체화면 해제되지 않게 처리

:href 태그를 사용하여 파일 다운로드를 하게되면 모바일에서 fullscreen이 자동으로 해제되는 현상이 발생하였다. axios를 사용하여 파일을 다운로드 처리하여 모바일에서 풀스크린이 자동으로 해제되지 않도록 처리하였다. 코드는 아래와 같다 function fnDownloadFile(url, fileName){ axios({ url: url, //your url method: 'GET', responseType: 'blob', // important }).then((response) => { const url = window.URL.createObjectURL(new Blob([response.data])); const link = document.createElement('a'); link.href = url; link.setAttribute('download', fileName); //or any other extension document.body.appendChild(l...



원문링크 : Vue.js 파일 다운로드시 모바일 전체화면 해제되지 않게 처리