소스 검색

Fixed CORS issue when loading arozos into iframe

Toby Chui 3 년 전
부모
커밋
e0cbe6f53a
2개의 변경된 파일7개의 추가작업 그리고 2개의 파일을 삭제
  1. 0 1
      web/desktop.system
  2. 7 1
      web/script/ao_module.js

+ 0 - 1
web/desktop.system

@@ -3140,7 +3140,6 @@
                 while(segEnd < filenameSegments.length && (currentSegmentWidth + spaceWidth)  < (maxlength - 5)){
                     //When it is not the last segment && can still fit more segment into current line
                     currentSegmentText = currentSegmentText + " " + filenameSegments[segEnd];
-                    console.log(currentSegmentText, getTextPixelWidth(currentSegmentText));
                     currentSegmentWidth = getTextPixelWidth(currentSegmentText);
                     segEnd++;
                 }

+ 7 - 1
web/script/ao_module.js

@@ -10,8 +10,14 @@
     E.g. ../script/ao_module.js (OK)
            /script/ao_module.js (NOT OK)
 */
+var ao_module_virtualDesktop = false;
+try{
+    ao_module_virtualDesktop = !(!parent.isDesktopMode);
+}catch(ex){
+    //Running ArozOS inside iframe for some reason
+    console.log("CORS Access Error. Entering compatibility mode with virtual desktop mode disabled.");
+}
 
-var ao_module_virtualDesktop = !(!parent.isDesktopMode);
 var ao_root = null;
 //Get the current windowID if in Virtual Desktop Mode, return false if VDI is not detected
 var ao_module_windowID = false;