浏览代码

Update index.js

aWeirdo 7 年之前
父节点
当前提交
6906d44b78
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      Playground/js/index.js

+ 5 - 1
Playground/js/index.js

@@ -179,7 +179,11 @@ function showError(errorMessage, errorEvent) {
         var checkTypescriptSupport = function(xhr) {
             var filename = location.pathname.substring(location.pathname.lastIndexOf('/') + 1);
             if (xhr.responseText.indexOf("class Playground") !== -1) {// Typescript content
-                if (filename !== "ts.html") {
+                if(!filename) {
+                    window.location.href = location.protocol + "//" + location.host + "/ts.html" + window.location.hash;
+                    return false;
+                }
+                else if (filename !== "ts.html") {
                     window.location.href = location.protocol + "//" + location.host + location.pathname.replace(filename, "ts.html") + window.location.hash;
                     return false;
                 }