Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 140161

Download Excel VueJS with Protected View off

$
0
0

I have created a promise in Vue that returns some data that I am creating a Excel Spreadsheet with. I have the spreadsheet opening with the data populated, however it opens it in Protected View, is there any way to ensure I open it in normal view?

Here is the code

from my vuex store...

    exportSearch: ({commit, state, rootGetters}) => {
     return new Promise(resolve, reject) => {
      Vue.http.post(`URI PLACEHOLDER`, {responseType: "blob")
    .then((response) => {
      resolve(response);
    })
    .catch(() => {
      reject();
    })
   })
  })

Then in my export button

methods:{
 saveFile: function(){
 this.$store.dispatch('search/exportSearch')
 .then((response) => {
  let filename = (response.headers.get('Content-Disposition') || '').split('filename=')[1];
  if(filename !=== ''){
   filename = filename.replace(/['"]/g, '')
  }
  let link = document.createElement('a');
  link.href = window.URL.createObjectURL(response.data);
  link.download = filename
  document.body.appendChild(link)
  link.click();
  document.body.removeChild(link)
}

Viewing all articles
Browse latest Browse all 140161

Trending Articles