mardi 21 juin 2016

redirect to external url in ember.js controller

I have this code and I would like to redirect to other url in controller file. It works fine in web browser but it is not working on android, iphone devices. I am testing them on browserstack.

return unchartedAjax({
            url: "/api/v1/detect",
            type: 'PUT',
            dataType: 'json'                
          })
          .then(() => {
            const device = this.deviceDetect();
            if (device === 'iOS') {
              window.location.href='http://ift.tt/28L7VLh';
              return;
            }
            else if (device === 'Android') {
              window.location.href='http://ift.tt/28LOc20';
              return;
            }

            this.send('reset');
            this.transitionToRoute('drivers.download');
            return;

          })
          .catch((result) => {
            const device = this.deviceDetect();
             if (device === 'iOS') {
              window.location.href='http://ift.tt/28L7SiC';
              return;
             }
             else if (device === 'Android') {
               window.location.href='http://ift.tt/28LOaav';
               return;
             }

              this.send('reset');
              this.transitionToRoute('drivers.download');
              return;



          })
          .finally(() => {
            this.set('loading', false);
          });




Aucun commentaire:

Enregistrer un commentaire