Prechádzať zdrojové kódy

Fixed minor path issue on file selector of Office Viewer

Toby Chui 2 rokov pred
rodič
commit
3a1531d13c

+ 0 - 1
web/OfficeViewer/embedded.html

@@ -1,6 +1,5 @@
 <!DOCTYPE html>
 <html>
-
 <head>
   <title>Office Viewer</title>
   <meta charset="utf-8">

+ 5 - 1
web/OfficeViewer/index.html

@@ -44,7 +44,11 @@
                 }else{
                     console.log(encodeURIComponent(JSON.stringify(filedata)));
                     ao_module_setWindowSize(1060, 680);
-                    window.location.href= window.location.href + "/embedded.html#" + encodeURIComponent(JSON.stringify(filedata));
+                    let redirectionURL = "embedded.html#" + encodeURIComponent(JSON.stringify(filedata));
+                    if (window.location.href.substr(window.location.href.length - 1) != "/"){
+                        redirectionURL = "/" + redirectionURL;
+                    }
+                    window.location.href= window.location.href + redirectionURL;
                 }
             }
 		</script>