Use defer="defer" rather than onload to try and speed up page loading.

This commit is contained in:
Tom Hughes 2008-03-04 18:18:59 +00:00
parent 789c6343d9
commit a473b4ebd9
2 changed files with 7 additions and 6 deletions

View file

@ -44,7 +44,7 @@
for editing OpenStreetMap. for editing OpenStreetMap.
</div> </div>
<%= javascript_include_tag 'swfobject.js' %> <%= javascript_include_tag 'swfobject.js' %>
<script type="text/javascript"> <script type="text/javascript" defer="defer">
var brokenContentSize = $("content").offsetWidth == 0; var brokenContentSize = $("content").offsetWidth == 0;
var fo = new SWFObject("/potlatch/potlatch.swf?d="+Math.round(Math.random()*1000), "potlatch", "100%", "100%", "6", "#FFFFFF"); var fo = new SWFObject("/potlatch/potlatch.swf?d="+Math.round(Math.random()*1000), "potlatch", "100%", "100%", "6", "#FFFFFF");
// 700,600 for fixed size, 100%,100% for resizable // 700,600 for fixed size, 100%,100% for resizable
@ -105,7 +105,7 @@
} }
window.onresize = handleResize; window.onresize = handleResize;
window.onload = handleResize;
handleResize();
</script> </script>
<% end %> <% end %>

View file

@ -77,13 +77,13 @@ by the OpenStreetMap project and it's contributors.
<%= javascript_include_tag 'map.js' %> <%= javascript_include_tag 'map.js' %>
<script type="text/javascript"> <script type="text/javascript" defer="defer">
<!-- <!--
var brokenContentSize = $("content").offsetWidth == 0; var brokenContentSize = $("content").offsetWidth == 0;
var marker; var marker;
var map; var map;
function init(){ function mapInit(){
map = createMap("map"); map = createMap("map");
<% if bbox %> <% if bbox %>
@ -179,6 +179,7 @@ by the OpenStreetMap project and it's contributors.
} }
window.onresize = handleResize; window.onresize = handleResize;
window.onload = init;
mapInit();
// --> // -->
</script> </script>