OpenLayers: OpenLayers vector layer won't render, or renders weirdly in Internet Explorer (the usual culprit).

Platform:OpenLayers
Task:OpenLayers vector layer won't render, or renders weirdly in Internet Explorer (the usual culprit).
Discussion:
As usual IE causes problems with OpenLayers. I was trying to put a bounding box feature into a vector layer to show the extens of a study area. Firefox ran in fine but IE refused to show the bounding box until I panned the map a little bit or interacted with it in some other way. Additionally, my labels were offset. Then I learned about the script attribute 'defer'. This attribute is IE only (yet another rube goldberg jerry rigged half solution designed to make IE seem like a real standards compliant browser). Basically the browser runs the Init() function after the page renders (except in IE). the 'defer' attribute causes the script to be run after the page is rendered. I put the below just before the tag in my page and all my problems disappeared.
Example:
<!--- keep this script here.  defers running init() until AFTER the whole page loads.  keeps IE honest. --->
<script defer="defer" type="text/javascript">
init();
</script>

</body>
Back to Index