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

JavaScript doesn't work correctly on Safari 5.1.5

Hello!


*********************************
Could you tell me why it happend?
Is it a bug with Safari 5.1.5?
*********************************


I found that JavaScript doesn't work correctly on Safari 5.1.5 (My MacOS is
10.7.3).

There are three simple src files in my webapp.
------
1. SafariTest.jsp
2. web.xml
3. SafariTest.java
------


My [SafariTest.jsp] is like below:
------
<html>
<head>
<%
String strFromFlag=(String)request.getAttribute("FromFlag");
%>
<script type="text/javascript">
function start()
{
if ("FromServlet" == "<%= strFromFlag %>")
{
alert(document.frmSafari2.test1.value);
}
else
{
document.frmSafari1.submit();
}
}
</script>
</head>
<body onLoad="start();">
<%
if ("FromServlet".equals(strFromFlag))
{
%>
<form name="frmSafari2">
<input type="hidden" name="test1" value="TestOK"/>
</form>
<%
} else {
%>
<form name="frmSafari1" method="POST" action="SafariTest.do">
<input type="hidden" name="test1" value="TestNG"/>
</form>
<%
}
%>
</body>
</html>
------


And [web.xml] is like below:
------
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<servlet>
<servlet-name>Safari Test</servlet-name>
<servlet-class>com.example.web.SafariTest</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Safari Test</servlet-name>
<url-pattern>/SafariTest.do</url-pattern>
</servlet-mapping>
</web-app>
------


And [SafariTest.java] is like below:
------
package com.example.web;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class SafariTest extends HttpServlet {
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
request.setAttribute("FromFlag", "FromServlet");
RequestDispatcher view = request.getRequestDispatcher("SafariTest.jsp");
view.forward(request, response);
}
}
------

Then I compiled SafariTest.java and put them into Tomcat 5.5.28's [webapps]
directory like below.
------
├─SafariTest SafariTest.jsp
│ └─WEB-INF web.xml
│ └─classes
│ └─com
│ └─example
│ └─web SafariTest.class
------
After I started Tomcat 5.5.28, and access
http://xxx.xxx.xxx.xxx/SafariTest/SafariTest.jsp via Safari 5.1.5,
I got the [TestNG] alerted.


I think [TestNG] is not the right result because with Firefox 3.6.13 or
Safari 5.1.3, I can get the [TestOK] alerted.


When access SafariTest.jsp directly, the FromFlag is null and thus submit to
SafariTest servlet. In SafariTest servlet, I only set the FromFlag to
[FromServlet] and forward to SafariTest.jsp once again. Now because of FromFlag
is [FromServlet], I think that [TestOK] will be alerted.


Yours sincerely.
Ye Qing
2012/05/08

Posted on May 7, 2012 10:39 PM

Reply
7 replies

May 31, 2012 4:41 PM in response to buckaroogirl

I can not find any official document(it may be existed) that can prove it's a bug with Safari, and I exactly want to confirm that if it's a bug with Safari 5.1.4~5.1.6 or not!


It might be worth registering (for free) as an Apple Developer:


http://developer.apple.com/programs/register/


... and then you can use the Bug Reporter to submit trackable bug reports:


http://developer.apple.com/bugreporter/


(If it's a known bug, they'll probably contact you to say so.)

JavaScript doesn't work correctly on Safari 5.1.5

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