OLD | NEW |
1 <html> | 1 <html> |
2 <script> | 2 <script> |
3 var iframe_hosts = ['http://127.0.0.1', 'http://localhost']; | 3 var iframe_hosts = ['http://127.0.0.1', 'http://localhost']; |
4 function getIFrameSrc(iframe_id) { | 4 function getIFrameSrc(iframe_id) { |
5 var port = location.port; | 5 var port = location.port; |
6 var path = location.pathname.substring(0, location.pathname.lastIndexOf('/')); | 6 var path = location.pathname.substring(0, location.pathname.lastIndexOf('/')); |
7 var url = iframe_hosts[iframe_id] + ':' + port + path + '/simple.html'; | 7 var url = iframe_hosts[iframe_id] + ':' + port + path + '/simple.html'; |
8 return url; | 8 return url; |
9 } | 9 } |
10 function addIFrame(iframe_id, iframe_src) { | 10 function addIFrame(iframe_id, iframe_src) { |
11 var id = 'iframe_' + iframe_id; | 11 var id = 'iframe_' + iframe_id; |
12 var iframe = document.getElementById(id); | 12 var iframe = document.getElementById(id); |
13 if (iframe_src) { | 13 if (iframe_src) { |
14 iframe.src = iframe_src; | 14 iframe.src = iframe_src; |
15 } else { | 15 } else { |
16 iframe.src = getIFrameSrc(iframe_id); | 16 iframe.src = getIFrameSrc(iframe_id); |
17 } | 17 } |
18 return "" + iframe_id; | 18 return "" + iframe_id; |
19 } | 19 } |
20 </script> | 20 </script> |
21 <body> | 21 <body> |
22 <iframe id="iframe_0"></iframe> | 22 <iframe id="iframe_0" name="iframe_0"></iframe> |
23 <iframe id="iframe_1"></iframe> | 23 <iframe id="iframe_1" name="iframe_1"></iframe> |
24 Testing Geolocation with iframes. | 24 Testing Geolocation with iframes. |
25 </body> | 25 </body> |
26 </html> | 26 </html> |
27 | 27 |
OLD | NEW |