javascriptember.jsember-cliember.js-view

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='https://itunes.apple.com/us/app/app-id.com';
              return;
            }
            else if (device === 'Android') {
              window.location.href='http://play.google.com/store/apps/details?id=url';
              return;
            }

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

          })
          .catch((result) => {
            const device = this.deviceDetect();
             if (device === 'iOS') {
              window.location.href='https://itunes.apple.com/us/app/url.com';
              return;
             }
             else if (device === 'Android') {
               window.location.href='http://play.google.com/store/apps/details?id=appId';
               return;
             }

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



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

Solution

  • it was cache issue, after clearing cache it worked fine