Kaynağa Gözat

fix(mobile-landing): do not attempt opening download link in new window

Instead let the mobile OS take care of opening the URL
in the appropriate application. Without target _blank,
iOS 13.2.2 on Chrome will open about:blank and immediately
close the tab instead of opening the store.
j8
virtuacoplenny 5 yıl önce
ebeveyn
işleme
17c1f50fc3

+ 21
- 6
react/features/deep-linking/components/DeepLinkingMobilePage.web.js Dosyayı Görüntüle

@@ -94,6 +94,23 @@ class DeepLinkingMobilePage extends Component<Props> {
94 94
         const downloadButtonClassName
95 95
             = `${_SNS}__button ${_SNS}__button_primary`;
96 96
 
97
+
98
+        const onOpenLinkProperties = _URLS[Platform.OS]
99
+            ? {
100
+                // When opening a link to the download page, we want to let the
101
+                // OS itself handle intercepting and opening the appropriate
102
+                // app store. This avoids potential issues with browsers, such
103
+                // as iOS Chrome, not opening the store properly.
104
+            }
105
+            : {
106
+                // When falling back to another URL (Firebase) let the page be
107
+                // opened in a new window. This helps prevent the user getting
108
+                // trapped in an app-open-cycle where going back to the mobile
109
+                // browser re-triggers the app-open behavior.
110
+                target: '_blank',
111
+                rel: 'noopener noreferrer'
112
+            };
113
+
97 114
         return (
98 115
             <div className = { _SNS }>
99 116
                 <div className = 'header'>
@@ -113,20 +130,18 @@ class DeepLinkingMobilePage extends Component<Props> {
113 130
                         { t(`${_TNS}.appNotInstalled`, { app: NATIVE_APP_NAME }) }
114 131
                     </p>
115 132
                     <a
133
+                        { ...onOpenLinkProperties }
116 134
                         href = { this._generateDownloadURL() }
117
-                        onClick = { this._onDownloadApp }
118
-                        rel = 'noopener noreferrer'
119
-                        target = '_blank'>
135
+                        onClick = { this._onDownloadApp }>
120 136
                         <button className = { downloadButtonClassName }>
121 137
                             { t(`${_TNS}.downloadApp`) }
122 138
                         </button>
123 139
                     </a>
124 140
                     <a
141
+                        { ...onOpenLinkProperties }
125 142
                         className = { `${_SNS}__href` }
126 143
                         href = { generateDeepLinkingURL() }
127
-                        onClick = { this._onOpenApp }
128
-                        rel = 'noopener noreferrer'
129
-                        target = '_blank'>
144
+                        onClick = { this._onOpenApp }>
130 145
                         {/* <button className = { `${_SNS}__button` }> */}
131 146
                         { t(`${_TNS}.openApp`) }
132 147
                         {/* </button> */}

Loading…
İptal
Kaydet