I added a Listener to set the Content-Type to text/html and - helas! - it works just fine.
public void beforePhase(PhaseEvent event) {
FacesContext context = FacesContext.getCurrentInstance();
ExternalContext extContext = context.getExternalContext();
Object response = extContext.getResponse();
if (event.getPhaseId() == PhaseId.RENDER_RESPONSE) {
String contentType = "text/html; charset=UTF-8";
if (response instanceof ServletResponse) {
((ServletResponse) response).setContentType(contentType);
} else if (response instanceof RenderResponse) {
((RenderResponse) response).setContentType(contentType);
}
}
}
Thanks! Exactly what I was looking for, amazing that Safari can be such a pain to work with in this regard.
ReplyDeleteThis fixes Chrome as well!!
ReplyDeletehey! although this post is a bit old now, i got the same problem - chrome throwing that JS-error
ReplyDeletei'm working with jsf not long enought to know where to put the listenerobject and how to set the attributes that call this method. can you give me a hint?
firestorm696, configure the listener in your faces-config.xml:
ReplyDelete<lifecycle>
<phase-listener>org.j4fry.dojo.listener.SetContentTypeListener</phase-listener>
</lifecycle>
Best regards,
Ganesh
thanks a lot!
ReplyDeleteI kiss your feet, master!
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis article is over a year old but it very quickly resolved my cross-browser issues with a complex facelets based application. I need to understand the issue and the solution better but it certainly gets me up and running for now. Many, many thanks :)
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis was very helful :)
ReplyDeleteWe can also use contentType = " text/html " in < f : view > (spaced out cause blogspot would refuse to accept it.