[OpenLayers-Users] IE7 Error when adding vector layer
Christopher Schmidt
crschmidt at metacarta.com
Fri Aug 14 09:03:39 EDT 2009
On Fri, Aug 14, 2009 at 04:00:36AM -0500, Derek Watling wrote:
>
> I am having problems with IE7 when adding a vector layer to the map.
>
> I am using ASP.NET with a Master page and a custom build of OpenLayers 2.8.
> The begining of my Master page is as follows:
>
> <%@ Master Language="VB" CodeFile="CMAMaster.master.vb"
> Inherits="MasterPage" %>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
>
> <head runat="server">
> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
> ...
>
> The OpenLayers.js is then included in the ScriptManagerProxy for the pages
> that require it.
>
> Everything works perfectly in IE8, Firefox and Safari with these settings.
> However IE7 usually (but not always) gives an "Unspecified error". If I
> remove the vector layer from the map it works fine in IE7.
>
> The code to add the vector layer is:
> ...
> var SPStyle = {
> strokeColor: 'red',
> strokeWidth: 2,
> fillColor: 'red',
> fillOpacity: '0.15',
> borderStyle: 'solid'
> }
>
> SPLayer = new OpenLayers.Layer.Vector("Subject Property");
> SPLayer.displayInLayerSwitcher = false;
> SPLayer.style = SPStyle;
> map.addLayer(SPLayer);
> ...
>
> Any help on how to work around this issue would be greatly appreciated.
Most likely, you are launching your code too early. Make sure you wait
until the page's "onload" event to start your code.
--
Christopher Schmidt
MetaCarta
More information about the Users
mailing list