I am getting an error that is only reproducible in Firefox.
In IE, it always works.
I have an ASP.NET application that targets an applet. For most functionality, it works great, but when I run one function (a function that does a lot of different things), the methods on the java applet seems to be unavailable! When I call any functions on the java applet from Javascript code, I get the error : myApplet.myFunction is not a function .
After this has happened, I get the same error for everything that calls functions on the applet, also functionality that worked prior to this state.
The applet is not unloaded or crashed, which is proved by that the interactive functions in the applet still works. But if the applet calls a javascript function on the page that calls back to the applet, I get the same error!
Sometimes it works when I repeat the action several times.
This only happens on the public version of the web application. Not in my local web app that runs on development machine. The main difference is that the public one use login access.
Can anyone give me hint of what can be causing this?
To summairize whats happens: When I run a particular bit of javascript code, the API against the java applet becomes unabailable (Error: myApplet.myFunction is not a function).
Here is the function that causes this buggy state of the applet:
function ParseAndZoomToAddress (objString) {
var mapFrame
eval("var objArray = new Array(" + objString + ")")
if (objArray.length > 0) {
mapFrame = window.frames[0].frames['mapFrame']
if(!mapFrame) alert('mapFrame is null!')
else window.status = 'mapFrame is OK!'
var center_x = 0
var center_y = 0
if(objArray.length == 1) {
var rExp1 = /[G-P]/g
var rExp2 = /[Q-Z]/g
eval("var coordArray = new Array(" + objArray[0].replace(rExp1, '0x').replace(rExp2, ',0x') + ")")
if(coordArray.length == 2){
center_x = coordArray[0]
center_y = coordArray[1]
}else{
alert("Invalid ID " + objArray[0])
}
}else{
var center_x = objArray[1]
var center_y = objArray[2]
}
var objZoomScale = '2000' // document.SearchForm.Scale.value
var scale = mapFrame.m_yur - mapFrame.m_yll
if (objZoomScale != "") {
scale = ScaleToMeter(parseInt(objZoomScale),mapFrame.m_image_width)
}
var xll = center_x - (scale / 2.0)
var yll = center_y - 10
var xur = xll + scale
var yur = center_y + 10
center_x = (xll + xur) / 2.0
center_y = (yll + yur) / 2.0
center_x = Math.round(center_x * 1000) / 1000
center_y = Math.round(center_y * 1000) / 1000
mapFrame.ResetClipPolygon() //This calls applet methods
var lCenterSymbol = '5024,40,85,x,y,5'
var rExp = /x/gi
lCenterSymbol = lCenterSymbol.replace(rExp,center_x)
rExp = /y/gi
lCenterSymbol = lCenterSymbol.replace(rExp,center_y)
mapFrame.parent.m_CenterSymbolString = lCenterSymbol
mapFrame.ResetClipPolygon() //This calls applet methods
mapFrame.previewVisible()
mapFrame.mapVisible()
mapFrame.setMove(false) //This calls applet methods
mapFrame.ZoomToArea(xll, yll, xur, yur) //This calls applet methods
mapFrame.parent.m_CenterSymbolString = ""
}
}
Additionaly I can say that the applet is defined by the <applet>
tag.
The applet is located inside a <div>
tag that is hidden in javascript with style.display='none'
and shown again with style.display='block'
.
This is done during the 2 lines:
mapFrame.previewVisible()
mapFrame.mapVisible()
I don't know if this is the problem, but these function are called elsewhere as well where it doesn't cause this, but it might be combination of things.
I am happy to get hint's that will help me solve this, not an absolute solution.
I will accept the best hint as the answer.