noobzilla


I'm catching the following error in Firefox 2+ when calling LoadMap():
"TypeError: this.InitializeMap() is not a function" this.InitializeMap() is called in the VE api. Does anyone know of a workaround

try

{
// FF 2.0 fix from MSDN Forums - http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=852512&SiteID=1
// Avoids the "Browser does not support SVG or VML" error
// If the browser is Firefox get the version number
var ffv = 0;
var ffn = "Firefox/"
var ffp = navigator.userAgent.indexOf(ffn);
if (ffp != -1) ffv = parseFloat(navigator.userAgent.substring(ffp + ffn.length));
// If we're using Firefox 1.5 or above override the Virtual Earth drawing functions to use SVG
if (ffv >= 1.5) {
Msn.Drawing.Graphic.CreateGraphic=function(f,b) { return new Msn.Drawing.SVGGraphic(f,b) }
}
// End of fix

m_VEMap = new VEMap(m_containerDivID);
// initial zoom factor is 12.
if (typeof initialZoomFactor == 'undefined')
initialZoomFactor = 12;
m_VEMap.LoadMap(m_VEMapCenterLatLong, initialZoomFactor, VEMapStyle.Road, false, VEMapMode.Mode2D, false);
m_VEMap.Resize(width, height);
}
catch(e)
{
//TODO: log
alert("Error loading VE map: " + e);
}



Re: Map not loading in Firefox 2+

Derek Chan


Can you post your entire html page so I can debug it Is initializemap() being called anywhere on the page










Re: Map not loading in Firefox 2+

noobzilla

InitializeMap() is not called on my page, its called in the LoadMap() method which is in veapi.ashx. Again, this only happens in FF2 (in IE and FF 1.5, etc. it works).





Re: Map not loading in Firefox 2+

noobzilla

Here's how I create the map container and draw the map. ConstuctMe() creates the container and calls RenderVEMap() which then fills the container.

var constructMe = function()
{
m_containerDiv = bodyDiv;
if ( createContainingDiv == true )
{
m_containerDiv = document.createElement("div");
m_containerDiv.className = mapDivClassName;
m_containerDiv.innerText = "Loading VE map - ID: " + m_containerDivID;
bodyDiv.appendChild(m_containerDiv);
}
// set the ID to the one we need for this instance.. regardless of where the container div comes from..
m_containerDiv.id = m_containerDivID;
RenderVEMap( );
}


var RenderVEMap = function( )
{
try
{
// FF 2.0 fix from MSDN Forums - http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=852512&SiteID=1
// Avoids the "Browser does not support SVG or VML" error
// If the browser is Firefox get the version number
var ffv = 0;
var ffn = "Firefox/"
var ffp = navigator.userAgent.indexOf(ffn);
if (ffp != -1) ffv = parseFloat(navigator.userAgent.substring(ffp + ffn.length));
// If we're using Firefox 1.5 or above override the Virtual Earth drawing functions to use SVG
if (ffv >= 1.5) {
Msn.Drawing.Graphic.CreateGraphic=function(f,b) { return new Msn.Drawing.SVGGraphic(f,b) }
}
// End of fix

m_VEMap = new VEMap(m_containerDivID);
// initial zoom factor is 12.
if (typeof initialZoomFactor == 'undefined')
initialZoomFactor = 12;
m_VEMap.LoadMap(m_VEMapCenterLatLong, initialZoomFactor, VEMapStyle.Road, false, VEMapMode.Mode2D, false);
m_VEMap.Resize(width, height);
}
catch(e)
{
//TODO: log
alert("Error loading VE map: " + e);
}
}