loader: Fix screen-width option processing
authorYoumin Ha <youmin.ha@samsung.com>
Tue, 9 Apr 2013 08:33:59 +0000 (17:33 +0900)
committerYoumin Ha <youmin.ha@samsung.com>
Wed, 10 Apr 2013 14:57:34 +0000 (23:57 +0900)
Uses window.outerWidth with the top window, otherwise use
document.documentElement.clientWidth for web simulator.
Fixes Felica issue #154-2.

Change-Id: I27a2e6e5865e4bf2d57adb85e902a70182b8af39

src/js/jquery.mobile.tizen.loader.js

index 3973bd2..5d94c8e 100644 (file)
@@ -459,7 +459,13 @@ If developers do not give a viewport meta tag, Tizen Web UI Framework automatica
 
                        // screen-width support
                        if ( "screen-width" == viewportWidth ) {
-                               viewportWidth = window.innerWidth;
+                               if ( window.self == window.top ) {
+                                       // Top frame: for target. Use window.outerWidth.
+                                       viewportWidth = window.outerWidth;
+                               } else {
+                                       // iframe: for web simulator. Use clientWidth.
+                                       viewportWidth = document.documentElement.clientWidth;
+                               }
                        }
 
                        // set viewport meta tag