summaryrefslogtreecommitdiffstats
path: root/WebContent/VAADIN/vaadinBootstrap.js
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2011-12-15 14:22:09 +0200
committerLeif Åstrand <leif@vaadin.com>2011-12-15 14:22:22 +0200
commit129b0c84640afbc3da7fcb217869fd83710ef1f9 (patch)
tree1c41c5d9a62c7c66ab52419e26f3f02d599471e2 /WebContent/VAADIN/vaadinBootstrap.js
parent75141d2b0bf08ff018695d758c573d6f3c673d04 (diff)
downloadvaadin-framework-129b0c84640afbc3da7fcb217869fd83710ef1f9.tar.gz
vaadin-framework-129b0c84640afbc3da7fcb217869fd83710ef1f9.zip
Ensure WebBrowser is updated and available from BrowserDetails (#8098)
Diffstat (limited to 'WebContent/VAADIN/vaadinBootstrap.js')
-rw-r--r--WebContent/VAADIN/vaadinBootstrap.js78
1 files changed, 73 insertions, 5 deletions
diff --git a/WebContent/VAADIN/vaadinBootstrap.js b/WebContent/VAADIN/vaadinBootstrap.js
index 47656d9406..5728903545 100644
--- a/WebContent/VAADIN/vaadinBootstrap.js
+++ b/WebContent/VAADIN/vaadinBootstrap.js
@@ -86,11 +86,8 @@
// Root id
url += ((/\?/).test(url) ? "&" : "?") + "browserDetails";
url += '&rootId=' + getConfig('rootId');
- // Uri fragment
- url += '&f=' + encodeURIComponent(location.hash);
- if (window.name) {
- url += '&wn=' + encodeURIComponent(window.name);
- }
+ url += '&' + vaadin.getBrowserDetailsParameters(appId);
+
// Timestamp to avoid caching
url += '&' + (new Date()).getTime();
@@ -186,6 +183,77 @@
callback(appId);
}
widgetsets[widgetset].pendingApps = null;
+ },
+ getBrowserDetailsParameters: function(parentElementId) {
+ // Screen height and width
+ var url = 'sh=' + window.screen.height;
+ url += '&sw=' + window.screen.width;
+
+ // Window height and width
+ var cw = 0;
+ var ch = 0;
+ if(typeof(window.innerWidth) == 'number') {
+ // Modern browsers
+ cw = window.innerWidth;
+ ch = window.innerHeight;
+ } else {
+ // IE 8
+ cw = document.documentElement.clientWidth;
+ ch = document.documentElement.clientHeight;
+ }
+ url += '&cw=' + cw + '&ch=' + ch;
+
+
+ var d = new Date();
+
+ url += '&curdate=' + d.getTime();
+
+ var tzo1 = d.getTimezoneOffset(); // current offset
+ var dstDiff = 0;
+ var rtzo = tzo1;
+
+ for (var m=12;m>0;m--) {
+ d.setUTCMonth(m);
+ var tzo2 = d.getTimezoneOffset();
+ if (tzo1 != tzo2) {
+ dstDiff = (tzo1 > tzo2 ? tzo1-tzo2 : tzo2-tzo1); // offset w/o DST
+ rtzo = (tzo1 > tzo2 ? tzo1 : tzo2); // offset w/o DST
+ break;
+ }
+ }
+
+ // Time zone offset
+ url += '&tzo=' + tzo1;
+
+ // DST difference
+ url += '&dstd=' + dstDiff;
+
+ // Raw time zone offset
+ url += '&rtzo=' + rtzo;
+
+ // DST in effect?
+ url += '&dston=' + (tzo1 != rtzo);
+
+ var pe = document.getElementById(parentElementId);
+ if (pe) {
+ url += '&vw=' + pe.offsetWidth;
+ url += '&vh=' + pe.offsetHeight;
+ }
+
+ // Uri fragment
+ if (location.hash) {
+ //Remove initial #
+ url += '&fr=' + encodeURIComponent(location.hash.replace(/^#/, ""));
+ }
+ // Window name
+ if (window.name) {
+ url += '&wn=' + encodeURIComponent(window.name);
+ }
+
+ // Detect touch device support
+ try { document.createEvent("TouchEvent"); url += "&td=1";} catch(e){};
+
+ return url;
}
};