0

After Getting the AXIOS api response i need to Redirect to the url in a new tab.

Currently i am achieving this using window.open("url") inside the api call as like below.

viewimage(image) {
          Nova.request().get(`/showimage/`+image,)
              .then(response => {
                this.urlimage = response.request.responseURL;
                window.open(this.urlimage,'_blank');
               
              });
    },

But i like to confirm whether its right process to use window.open("url") in axios in production environment because i am facing pop-up blocked in all browsers.

If any other alternate way to achieve this ? Please guide me from your side.

Thanks,

hari
  • 5
  • 3

2 Answers2

1

if you use vue-router you should use router.push("yourroutename").

Otherwise, window.location.href = 'some url'; works fine for non single-page apps.

original answer: Vue.js redirection to another page

Elabbasy00
  • 628
  • 9
  • 21
1

simple solution

I am using this in my project I am currently working on this.$router.push("/this.urlimage");

cooldar
  • 56
  • 3