Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Safari fails to recognize object as string

I created the page http://epoch.chem.uky.edu/epoch-plugin/public/indexOfTest2.jsp to illustrate what appears to be a new bug in Safari. Click on any drawing in the bottom toolbar, click in the drawing space, and press the button underneath. Two alerts come up. They are created by this JavaScript code:

function getIndexOf() {
var testStr = document.responseApplet.getMol("mrv");
alert("testStr is " + (typeof testStr)
+ ", testStr.indexOf('?x') = " + testStr.indexOf('?x')
+ ", testStr.indexOf('x2=') = " + testStr.indexOf('x2=')
+ ", testStr=\n" + testStr);
testStr = '' + testStr;
alert("after modifying testStr, testStr is " + (typeof testStr)
+ ", testStr.indexOf('?x') = " + testStr.indexOf('?x')
+ ", testStr.indexOf('x2=') = " + testStr.indexOf('x2=')
+ ", testStr=\n" + testStr);
}

You can see that when Safari retrieves the value from the applet, it thinks it has the type object, and it is unable to find the requested substrings in the value. On the other hand, Firefox 3.0 for Mac and InternetExplorer 7.0 for PC know right away that the retrieved value is a String. Interestingly, Firefox 2.0 for PC says that testStr is an object, but it is still able to find the substrings in the returned value. Only Safari is unable to find the substrings.

This appears to be a new behavior for Safari. I have been using this applet for years and have never had this problem previously.

Anyone have any ideas why this is happening?

MacBook Pro, Mac OS X (10.5.8)

Posted on Oct 12, 2009 9:34 AM

Reply
1 reply

Safari fails to recognize object as string

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.