2016-06-21 85 views
0

我有這段代碼,我想重定向到控制器文件中的其他url。 它在web瀏覽器中工作正常,但它不適用於android,iphone設備。 我正在瀏覽器上測試它們。重定向到ember.js控制器中的外部url

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); 
      }); 
+1

你可能想打開一個新的瀏覽器窗口,呼叫'上的新窗口的'opener' – MilkyWayJoe

+0

HTTP close'://計算器.com/questions/20858199/android-redirect-does-not-work –

+0

http://stackoverflow.com/questions/16714578/use-of-window-location-doesnt-work-on-ipad –

回答

0

它的緩存問題,清除緩存後,它工作得很好