OLD | NEW |
1 <?php | 1 <?php |
2 header("ACCEPT-CH: DPR, Width, Viewport-Width"); | 2 header("ACCEPT-CH: DPR, Width, Viewport-Width, Device-RAM"); |
3 ?> | 3 ?> |
4 <!DOCTYPE html> | 4 <!DOCTYPE html> |
5 <body> | 5 <body> |
6 <script> | 6 <script> |
7 var fail = function(num) { | 7 var fail = function(num) { |
8 return function() { | 8 return function() { |
9 parent.postMessage("fail "+ num, "*"); | 9 parent.postMessage("fail "+ num, "*"); |
10 } | 10 } |
11 }; | 11 }; |
12 | 12 |
13 var success = function() { | 13 var success = function() { |
14 parent.postMessage("success", "*"); | 14 parent.postMessage("success", "*"); |
15 }; | 15 }; |
16 | 16 |
| 17 var loadDeviceRAMImage = function() { |
| 18 var img = new Image(); |
| 19 img.src = 'image-checks-for-device-ram.php'; |
| 20 img.onload = success; |
| 21 img.onerror = fail(4); |
| 22 document.body.appendChild(img); |
| 23 }; |
17 var loadRWImage = function() { | 24 var loadRWImage = function() { |
18 var img = new Image(); | 25 var img = new Image(); |
19 img.src = 'image-checks-for-width.php'; | 26 img.src = 'image-checks-for-width.php'; |
20 img.sizes = '500'; | 27 img.sizes = '500'; |
21 img.onload = success | 28 img.onload = loadDeviceRAMImage; |
22 img.onerror = fail(3); | 29 img.onerror = fail(3); |
23 document.body.appendChild(img); | 30 document.body.appendChild(img); |
24 }; | 31 }; |
25 var loadViewportImage = function() { | 32 var loadViewportImage = function() { |
26 var img = new Image(); | 33 var img = new Image(); |
27 img.src = 'image-checks-for-viewport-width.php'; | 34 img.src = 'image-checks-for-viewport-width.php'; |
28 img.onload = loadRWImage; | 35 img.onload = loadRWImage; |
29 img.onerror = fail(2); | 36 img.onerror = fail(2); |
30 document.body.appendChild(img); | 37 document.body.appendChild(img); |
31 }; | 38 }; |
32 var img = new Image(); | 39 var img = new Image(); |
33 img.src = 'image-checks-for-dpr.php'; | 40 img.src = 'image-checks-for-dpr.php'; |
34 img.onload = loadViewportImage; | 41 img.onload = loadViewportImage; |
35 img.onerror = fail(1); | 42 img.onerror = fail(1); |
36 document.body.appendChild(img); | 43 document.body.appendChild(img); |
37 </script> | 44 </script> |
38 </body> | 45 </body> |
OLD | NEW |