Thank you very much !!! Without *addHeader* the following code only worked on IE, but adding this line also works in Chrome and Firefox.
The problem was Chrome and Firefox html page didn't receive xmlhttp.status == 200, only xmlhttp.readyState == 4, only received status == 0. public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException{ *response.addHeader("Access-Control-Allow-Origin", "*");* PrintWriter out = response.getWriter(); java.util.Date today = new java.util.Date(); out.write("<html>\n" + "<body>\n" + "<h1 align=center>Ejemplo1 de Servlet</h1>\n" + "<br>\n" + today + "</body>\n"+ "</html>" ); } -- Pam On Tuesday, March 16, 2010 1:08:00 PM UTC-4, Ronen wrote: > > Excellent. Thanks very much T.J.. your idea worked. > > In my servlet, I overrided the doOptions() method from HttpServlet and > returned the response headers that you suggested: > > > response.addHeader("Access-Control-Allow-Origin", "*"); > > response.addHeader("Access-Control-Allow-Methods", > request.getHeader("Access-Control-Request-Methods")); > > response.addHeader("Access-Control-Allow-Headers", > request.getHeader("Access-Control-Request-Headers")); > > and Firefox and Chrome both started working beautifully (also verified > that IE still works). > > In the end, my overall intent is to package this HTML file with my web > application, so it sounds like I won't need to have this doOptions() > in my servlet. It's just that in the beginning, I figured I would > test the HTML file outside of the web app and I guess I didn't realize > I would run into this kind of trouble. Still, it's always good to > know how to go about fixing something like this in the future. > > Thanks for everyone's help. > > --Ronen > > -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To unsubscribe from this group and stop receiving emails from it, send an email to prototype-scriptaculous+unsubscr...@googlegroups.com. To post to this group, send email to prototype-scriptaculous@googlegroups.com. Visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en. For more options, visit https://groups.google.com/groups/opt_out.