Browse Source

Added https detection to navigator.share func

Toby Chui 3 years ago
parent
commit
2ff50bf398
2 changed files with 10 additions and 2 deletions
  1. 5 1
      system/share/downloadPage.html
  2. 5 1
      system/share/downloadPageFolder.html

+ 5 - 1
system/share/downloadPage.html

@@ -89,7 +89,7 @@
                         </tbody>
                       </table>
                     <a href="{{downloadurl}}"><button class="button-primary">Download</button></a>
-                    <button onclick="share();">Share</button>
+                    <button id="sharebtn" onclick="share();">Share</button>
                     <br><br>
                     <p>Request File ID: {{reqid}}</p>
                     <p>Request Timestamp: {{reqtime}}</p>
@@ -110,6 +110,10 @@
 
         
     <script>
+      if (location.protocol !== 'https:') {
+         document.getElementById("sharebtn").remove()
+      }
+
       function share(){
         let shareData = {
           title: "{{filename}}",

+ 5 - 1
system/share/downloadPageFolder.html

@@ -115,7 +115,7 @@
                         </tbody>
                       </table>
                     <a href="{{downloadurl}}"><button class="button-primary">Download All</button></a>
-                    <button onclick="share();">Share</button>
+                    <button id="sharebtn" onclick="share();">Share</button>
                     <p style="font-size: 80%;"><b>Depending on folder size, zipping might take a while to complete.</b></p>
                     <p>Request File ID: {{reqid}}<br>
                     Request Timestamp: {{reqtime}}</p>
@@ -156,6 +156,10 @@
         handleWindowResize();
       });
 
+      if (location.protocol !== 'https:') {
+         document.getElementById("sharebtn").remove()
+      }
+
       function share(){
         let shareData = {
           title: "{{filename}}",